Method: GoogleDrive::Session#spreadsheet_by_url

Defined in:
lib/google_drive/session.rb

#spreadsheet_by_url(url) ⇒ Object

Returns GoogleDrive::Spreadsheet with given url. You must specify either of:

  • URL of the page you open to access the spreadsheet in your browser

  • URL of worksheet-based feed of the spreadseet

e.g.

session.spreadsheet_by_url(
  "https://docs.google.com/spreadsheets/d/1L3-kvwJblyW_TvjYD-7pE-AXxw5_bkb6S_MljuIPVL0/edit")
session.spreadsheet_by_url(
  "https://spreadsheets.google.com/feeds/" +
  "worksheets/1L3-kvwJblyW_TvjYD-7pE-AXxw5_bkb6S_MljuIPVL0/private/full")


274
275
276
277
278
279
280
# File 'lib/google_drive/session.rb', line 274

def spreadsheet_by_url(url)
  file = file_by_url(url)
  unless file.is_a?(Spreadsheet)
    fail(GoogleDrive::Error, 'The file with the URL is not a spreadsheet: %s' % url)
  end
  file
end