In [1]:
require 'daru/view'
Install the spreadsheet gem version ~>1.1.1 for using spreadsheet functions.

Install the mechanize gem version ~>2.7.5 for using mechanize functions.
Out[1]:
true
In [2]:
Daru::View.plotting_library = :googlecharts
Out[2]:
:googlecharts
In [3]:
data_str = 'https://docs.google.com/spreadsheets/d/1aXns2ch8y_rl9ZLxSYZIU5ewUB1ZNAg5O6iPLZLApZI/gviz/tq?header=1&tq='
table = Daru::View::Table.new(data_str, width: 500)
table.show_in_iruby
Out[3]:
In [4]:
plot = Daru::View::Plot.new(data_str, {type: :bar, width: 800})
plot.show_in_iruby
Out[4]:
In [5]:
query1 = 'SELECT C, sum(B) group by C'
table = Daru::View::Table.new(data_str + query1, width: 800)
table.show_in_iruby
Out[5]:
In [6]:
query2 = 'SELECT * WHERE A > 1'
data_str << query2
table = Daru::View::Table.new(data_str, width: 800)
table.show_in_iruby
Out[6]:
In [7]:
plot = Daru::View::Plot.new(data_str, {type: :line})
plot.show_in_iruby
Out[7]:
In [8]:
query_string = 'SELECT A, H, O, Q, R, U LIMIT 5 OFFSET 8'
data_spreadsheet = 'https://docs.google.com/spreadsheets/d/1XWJLkAwch5GXAt_7zOFDcg8Wm8Xv29_8PWuuW15qmAE/gviz/tq?gid=0&headers=1&tq='
table_spreadsheet = Daru::View::Table.new(data_spreadsheet + query_string, width: 800)
table_spreadsheet.show_in_iruby
Out[8]:
In [9]:
plot_spreadsheet = Daru::View::Plot.new(data_spreadsheet + query_string, {type: :area, width: 800})
plot_spreadsheet.show_in_iruby
Out[9]:
In [10]:
plot_sheet = Daru::View::Plot.new(data_spreadsheet + query_string, {type: :column, width: 800})
plot_sheet.show_in_iruby
Out[10]:
In [11]:
query = 'SELECT H, O, Q, R WHERE O > 1'
plot_sheet = Daru::View::Plot.new(data_spreadsheet + query)
plot_sheet.show_in_iruby
Out[11]:
In [ ]: