Class: GData::Spreadsheet
- Inherits:
-
Base
- Object
- Base
- GData::Spreadsheet
- Defined in:
- lib/roo/google.rb
Instance Method Summary collapse
-
#add_to_cell_roo(row, col, value, sheet_no = 1) ⇒ Object
– new @@ added sheet_no to definition.
-
#entry_roo(formula, row = 1, col = 1) ⇒ Object
– new.
-
#evaluate_cell(cell, sheet_no = 1) ⇒ Object
– modified.
- #fulldoc(sheet_no) ⇒ Object
-
#get_one_sheet ⇒ Object
– new.
-
#oben_unten_links_rechts(sheet_no) ⇒ Object
new.
-
#save_entry_roo(entry, sheet_no) ⇒ Object
– new @@ added sheet_no to definition.
-
#sheetlist ⇒ Object
– new.
Instance Method Details
#add_to_cell_roo(row, col, value, sheet_no = 1) ⇒ Object
– new @@ added sheet_no to definition
47 48 49 |
# File 'lib/roo/google.rb', line 47 def add_to_cell_roo(row,col,value, sheet_no=1) save_entry_roo(entry_roo(value,row,col), sheet_no) end |
#entry_roo(formula, row = 1, col = 1) ⇒ Object
– new
37 38 39 40 41 42 43 |
# File 'lib/roo/google.rb', line 37 def entry_roo(formula, row=1, col=1) <<XML <entry xmlns='http://www.w3.org/2005/Atom' xmlns:gs='http://schemas.google.com/spreadsheets/2006'> <gs:cell row='#{row}' col='#{col}' inputValue='#{formula}' /> </entry> XML end |
#evaluate_cell(cell, sheet_no = 1) ⇒ Object
– modified
9 10 11 12 13 14 15 16 |
# File 'lib/roo/google.rb', line 9 def evaluate_cell(cell, sheet_no=1) raise ArgumentError, "invalid cell: #{cell}" unless cell raise ArgumentError, "invalid sheet_no: #{sheet_no}" unless sheet_no >0 and sheet_no.class == Fixnum path = "/feeds/cells/#{@spreadsheet_id}/#{sheet_no}/#{@headers ? "private" : "public"}/basic/#{cell}" doc = Hpricot(request(path)) result = (doc/"content").inner_html end |
#fulldoc(sheet_no) ⇒ Object
70 71 72 73 74 |
# File 'lib/roo/google.rb', line 70 def fulldoc(sheet_no) path = "/feeds/cells/#{@spreadsheet_id}/#{sheet_no}/private/full" doc = Hpricot(request(path)) return doc end |
#get_one_sheet ⇒ Object
– new
52 53 54 55 |
# File 'lib/roo/google.rb', line 52 def get_one_sheet path = "/feeds/cells/#{@spreadsheet_id}/1/private/full" doc = Hpricot(request(path)) end |
#oben_unten_links_rechts(sheet_no) ⇒ Object
new
58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/roo/google.rb', line 58 def oben_unten_links_rechts(sheet_no) path = "/feeds/cells/#{@spreadsheet_id}/#{sheet_no}/private/full" doc = Hpricot(request(path)) rows = [] cols = [] (doc/"gs:cell").each {|item| rows.push item['row'].to_i cols.push item['col'].to_i } return rows.min, rows.max, cols.min, cols.max end |
#save_entry_roo(entry, sheet_no) ⇒ Object
– new @@ added sheet_no to definition
31 32 33 34 |
# File 'lib/roo/google.rb', line 31 def save_entry_roo(entry, sheet_no) path = "/feeds/cells/#{@spreadsheet_id}/#{sheet_no}/#{@headers ? 'private' : 'public'}/full" post(path, entry) end |
#sheetlist ⇒ Object
– new
19 20 21 22 23 24 25 26 27 |
# File 'lib/roo/google.rb', line 19 def sheetlist path = "/feeds/worksheets/#{@spreadsheet_id}/private/basic" doc = Hpricot(request(path)) result = [] (doc/"content").each { |elem| result << elem.inner_html } result end |