Class: MiniAutobot::GoogleSheets
- Inherits:
-
Object
- Object
- MiniAutobot::GoogleSheets
- Defined in:
- lib/mini_autobot/google_sheets.rb
Overview
Class that supports integration with Google Sheets See documentation here: developers.google.com/drive/v3/web/about-auth to set up OAuth 2.0 access to your sheets. Place the info in google_drive_config.json in your config/mini_autobot folder
To use, use the -g or –google_sheets parameter with the id of your sheet Example: -g 1gWbpPq7rrTdNtSJSN2ljDlPE-okf0w3w7ai5PlhY8bk
Instance Method Summary collapse
-
#initialize(args) ⇒ GoogleSheets
constructor
A new instance of GoogleSheets.
-
#update_cells(value, key) ⇒ Object
Updates all cells with the value provided that have the corresponding key in the Automation Serial Column At the end of your test, place the following line: Example: MiniAutobot.google_sheets.update_cells(‘Auto Pass’, ‘HP-1’) if MiniAutobot.settings.google_sheets?.
Constructor Details
#initialize(args) ⇒ GoogleSheets
Returns a new instance of GoogleSheets.
15 16 17 18 19 20 21 22 |
# File 'lib/mini_autobot/google_sheets.rb', line 15 def initialize(args) @args = args @session = session @spreadsheet = spreadsheet @worksheet = worksheet @automation_serial_column = automation_serial_column @selected_browser_column = selected_browser_column end |
Instance Method Details
#update_cells(value, key) ⇒ Object
Updates all cells with the value provided that have the corresponding key in the Automation Serial Column At the end of your test, place the following line: Example: MiniAutobot.google_sheets.update_cells(‘Auto Pass’, ‘HP-1’) if MiniAutobot.settings.google_sheets?
28 29 30 31 32 33 34 |
# File 'lib/mini_autobot/google_sheets.rb', line 28 def update_cells(value, key) rows = target_rows(key) rows.each do |row| @worksheet[row, @selected_browser_column] = value end @worksheet.save end |