Skip to content

Commit

Permalink
Fixes worksheet after Google drive gem update to 1.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
netbe committed Apr 22, 2015
1 parent ea16498 commit f98c502
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions lib/babelish/google_doc.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@ def download(requested_filename)

def download_spreadsheet(requested_filename, output_filename, worksheet_index = 0)
output_filename ||= "translations.csv"
file = file_with_name(requested_filename)
return nil unless file
file.export_as_file(output_filename, "csv", worksheet_index)
spreadsheet = file_with_name(requested_filename)
return nil unless spreadsheet
worksheet = spreadsheet.worksheets[worksheet_index]
worksheet.export_as_file(output_filename)
return output_filename
end

Expand All @@ -48,12 +49,7 @@ def file_with_name(name)
unless @session
authenticate
end
result = @session.file_by_title(name)
if result.is_a? Array
file = result.first
else
file = result
end
@session.spreadsheet_by_title(name)
end
end
end

0 comments on commit f98c502

Please sign in to comment.