Class: CSVPlusPlus::Writer::GoogleSheets
- Inherits:
-
BaseWriter
- Object
- BaseWriter
- CSVPlusPlus::Writer::GoogleSheets
- Defined in:
- lib/csv_plus_plus/writer/google_sheets.rb
Overview
A class that can output a Template
to Google Sheets (via their API)
Constant Summary collapse
- SPREADSHEET_INFINITY =
XXX it would be nice to raise this but we shouldn’t expand out more than necessary for our data
1000
Instance Attribute Summary
Attributes inherited from BaseWriter
Instance Method Summary collapse
-
#initialize(options) ⇒ GoogleSheets
constructor
initialize.
-
#write(template) ⇒ Object
write a
template
to Google Sheets.
Constructor Details
#initialize(options) ⇒ GoogleSheets
initialize
18 19 20 21 22 23 |
# File 'lib/csv_plus_plus/writer/google_sheets.rb', line 18 def initialize() super() @sheet_id = .google.sheet_id @sheet_name = .sheet_name end |
Instance Method Details
#write(template) ⇒ Object
write a template
to Google Sheets
26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/csv_plus_plus/writer/google_sheets.rb', line 26 def write(template) auth! save_spreadsheet! save_spreadsheet_values! create_sheet! if @options.create_if_not_exists update_cells!(template) rescue ::Google::Apis::ClientError => e handle_google_error(e) end |