Class: Google::Apis::SheetsV4::SheetsService
- Inherits:
-
Core::BaseService
- Object
- Core::BaseService
- Google::Apis::SheetsV4::SheetsService
- Defined in:
- generated/google/apis/sheets_v4/service.rb
Overview
Google Sheets API
Reads and writes Google Sheets.
Instance Attribute Summary collapse
-
#key ⇒ String
API key.
-
#quota_user ⇒ String
Available to use for quota purposes for server-side applications.
Attributes inherited from Core::BaseService
#authorization, #base_path, #batch_path, #client, #client_options, #request_options, #root_url, #upload_path
Instance Method Summary collapse
-
#append_spreadsheet_value(spreadsheet_id, range, value_range_object = nil, response_value_render_option: nil, insert_data_option: nil, value_input_option: nil, response_date_time_render_option: nil, include_values_in_response: nil, quota_user: nil, fields: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::SheetsV4::AppendValuesResponse
Appends values to a spreadsheet.
-
#batch_clear_values(spreadsheet_id, batch_clear_values_request_object = nil, quota_user: nil, fields: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::SheetsV4::BatchClearValuesResponse
Clears one or more ranges of values from a spreadsheet.
-
#batch_get_spreadsheet_values(spreadsheet_id, major_dimension: nil, ranges: nil, date_time_render_option: nil, value_render_option: nil, quota_user: nil, fields: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::SheetsV4::BatchGetValuesResponse
Returns one or more ranges of values from a spreadsheet.
-
#batch_update_spreadsheet(spreadsheet_id, batch_update_spreadsheet_request_object = nil, quota_user: nil, fields: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::SheetsV4::BatchUpdateSpreadsheetResponse
Applies one or more updates to the spreadsheet.
-
#batch_update_values(spreadsheet_id, batch_update_values_request_object = nil, quota_user: nil, fields: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::SheetsV4::BatchUpdateValuesResponse
Sets values in one or more ranges of a spreadsheet.
-
#clear_values(spreadsheet_id, range, clear_values_request_object = nil, quota_user: nil, fields: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::SheetsV4::ClearValuesResponse
Clears values from a spreadsheet.
-
#copy_spreadsheet(spreadsheet_id, sheet_id, copy_sheet_to_another_spreadsheet_request_object = nil, quota_user: nil, fields: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::SheetsV4::SheetProperties
Copies a single sheet from a spreadsheet to another spreadsheet.
-
#create_spreadsheet(spreadsheet_object = nil, quota_user: nil, fields: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::SheetsV4::Spreadsheet
Creates a spreadsheet, returning the newly created spreadsheet.
-
#get_spreadsheet(spreadsheet_id, include_grid_data: nil, ranges: nil, quota_user: nil, fields: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::SheetsV4::Spreadsheet
Returns the spreadsheet at the given ID.
-
#get_spreadsheet_values(spreadsheet_id, range, major_dimension: nil, date_time_render_option: nil, value_render_option: nil, quota_user: nil, fields: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::SheetsV4::ValueRange
Returns a range of values from a spreadsheet.
-
#initialize ⇒ SheetsService
constructor
A new instance of SheetsService.
-
#update_spreadsheet_value(spreadsheet_id, range, value_range_object = nil, response_value_render_option: nil, value_input_option: nil, response_date_time_render_option: nil, include_values_in_response: nil, quota_user: nil, fields: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::SheetsV4::UpdateValuesResponse
Sets values in a range of a spreadsheet.
Methods inherited from Core::BaseService
#batch, #batch_upload, #fetch_all, #http
Methods included from Core::Logging
Constructor Details
#initialize ⇒ SheetsService
Returns a new instance of SheetsService
45 46 47 48 |
# File 'generated/google/apis/sheets_v4/service.rb', line 45 def initialize super('https://sheets.googleapis.com/', '') @batch_path = 'batch' end |
Instance Attribute Details
#key ⇒ String
Returns API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
38 39 40 |
# File 'generated/google/apis/sheets_v4/service.rb', line 38 def key @key end |
#quota_user ⇒ String
Returns Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
43 44 45 |
# File 'generated/google/apis/sheets_v4/service.rb', line 43 def quota_user @quota_user end |
Instance Method Details
#append_spreadsheet_value(spreadsheet_id, range, value_range_object = nil, response_value_render_option: nil, insert_data_option: nil, value_input_option: nil, response_date_time_render_option: nil, include_values_in_response: nil, quota_user: nil, fields: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::SheetsV4::AppendValuesResponse
Appends values to a spreadsheet. The input range is used to search for
existing data and find a "table" within that range. Values will be
appended to the next row of the table, starting with the first column of
the table. See the
guide
and
sample code
for specific details of how tables are detected and data is appended.
The caller must specify the spreadsheet ID, range, and
a valueInputOption. The valueInputOption only
controls how the input data will be added to the sheet (column-wise or
row-wise), it does not influence what cell the data starts being written
to.
470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 |
# File 'generated/google/apis/sheets_v4/service.rb', line 470 def append_spreadsheet_value(spreadsheet_id, range, value_range_object = nil, response_value_render_option: nil, insert_data_option: nil, value_input_option: nil, response_date_time_render_option: nil, include_values_in_response: nil, quota_user: nil, fields: nil, options: nil, &block) command = make_simple_command(:post, 'v4/spreadsheets/{spreadsheetId}/values/{range}:append', ) command.request_representation = Google::Apis::SheetsV4::ValueRange::Representation command.request_object = value_range_object command.response_representation = Google::Apis::SheetsV4::AppendValuesResponse::Representation command.response_class = Google::Apis::SheetsV4::AppendValuesResponse command.params['spreadsheetId'] = spreadsheet_id unless spreadsheet_id.nil? command.params['range'] = range unless range.nil? command.query['responseValueRenderOption'] = response_value_render_option unless response_value_render_option.nil? command.query['insertDataOption'] = insert_data_option unless insert_data_option.nil? command.query['valueInputOption'] = value_input_option unless value_input_option.nil? command.query['responseDateTimeRenderOption'] = response_date_time_render_option unless response_date_time_render_option.nil? command.query['includeValuesInResponse'] = include_values_in_response unless include_values_in_response.nil? command.query['quotaUser'] = quota_user unless quota_user.nil? command.query['fields'] = fields unless fields.nil? execute_or_queue_command(command, &block) end |
#batch_clear_values(spreadsheet_id, batch_clear_values_request_object = nil, quota_user: nil, fields: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::SheetsV4::BatchClearValuesResponse
Clears one or more ranges of values from a spreadsheet. The caller must specify the spreadsheet ID and one or more ranges. Only values are cleared -- all other properties of the cell (such as formatting, data validation, etc..) are kept.
512 513 514 515 516 517 518 519 520 521 522 |
# File 'generated/google/apis/sheets_v4/service.rb', line 512 def batch_clear_values(spreadsheet_id, batch_clear_values_request_object = nil, quota_user: nil, fields: nil, options: nil, &block) command = make_simple_command(:post, 'v4/spreadsheets/{spreadsheetId}/values:batchClear', ) command.request_representation = Google::Apis::SheetsV4::BatchClearValuesRequest::Representation command.request_object = batch_clear_values_request_object command.response_representation = Google::Apis::SheetsV4::BatchClearValuesResponse::Representation command.response_class = Google::Apis::SheetsV4::BatchClearValuesResponse command.params['spreadsheetId'] = spreadsheet_id unless spreadsheet_id.nil? command.query['quotaUser'] = quota_user unless quota_user.nil? command.query['fields'] = fields unless fields.nil? execute_or_queue_command(command, &block) end |
#batch_get_spreadsheet_values(spreadsheet_id, major_dimension: nil, ranges: nil, date_time_render_option: nil, value_render_option: nil, quota_user: nil, fields: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::SheetsV4::BatchGetValuesResponse
Returns one or more ranges of values from a spreadsheet. The caller must specify the spreadsheet ID and one or more ranges.
365 366 367 368 369 370 371 372 373 374 375 376 377 |
# File 'generated/google/apis/sheets_v4/service.rb', line 365 def batch_get_spreadsheet_values(spreadsheet_id, major_dimension: nil, ranges: nil, date_time_render_option: nil, value_render_option: nil, quota_user: nil, fields: nil, options: nil, &block) command = make_simple_command(:get, 'v4/spreadsheets/{spreadsheetId}/values:batchGet', ) command.response_representation = Google::Apis::SheetsV4::BatchGetValuesResponse::Representation command.response_class = Google::Apis::SheetsV4::BatchGetValuesResponse command.params['spreadsheetId'] = spreadsheet_id unless spreadsheet_id.nil? command.query['majorDimension'] = major_dimension unless major_dimension.nil? command.query['ranges'] = ranges unless ranges.nil? command.query['dateTimeRenderOption'] = date_time_render_option unless date_time_render_option.nil? command.query['valueRenderOption'] = value_render_option unless value_render_option.nil? command.query['quotaUser'] = quota_user unless quota_user.nil? command.query['fields'] = fields unless fields.nil? execute_or_queue_command(command, &block) end |
#batch_update_spreadsheet(spreadsheet_id, batch_update_spreadsheet_request_object = nil, quota_user: nil, fields: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::SheetsV4::BatchUpdateSpreadsheetResponse
Applies one or more updates to the spreadsheet. Each request is validated before being applied. If any request is not valid then the entire request will fail and nothing will be applied. Some requests have replies to give you some information about how they are applied. The replies will mirror the requests. For example, if you applied 4 updates and the 3rd one had a reply, then the response will have 2 empty replies, the actual reply, and another empty reply, in that order. Due to the collaborative nature of spreadsheets, it is not guaranteed that the spreadsheet will reflect exactly your changes after this completes, however it is guaranteed that the updates in the request will be applied together atomically. Your changes may be altered with respect to collaborator changes. If there are no collaborators, the spreadsheet should reflect your changes.
138 139 140 141 142 143 144 145 146 147 148 |
# File 'generated/google/apis/sheets_v4/service.rb', line 138 def batch_update_spreadsheet(spreadsheet_id, batch_update_spreadsheet_request_object = nil, quota_user: nil, fields: nil, options: nil, &block) command = make_simple_command(:post, 'v4/spreadsheets/{spreadsheetId}:batchUpdate', ) command.request_representation = Google::Apis::SheetsV4::BatchUpdateSpreadsheetRequest::Representation command.request_object = batch_update_spreadsheet_request_object command.response_representation = Google::Apis::SheetsV4::BatchUpdateSpreadsheetResponse::Representation command.response_class = Google::Apis::SheetsV4::BatchUpdateSpreadsheetResponse command.params['spreadsheetId'] = spreadsheet_id unless spreadsheet_id.nil? command.query['quotaUser'] = quota_user unless quota_user.nil? command.query['fields'] = fields unless fields.nil? execute_or_queue_command(command, &block) end |
#batch_update_values(spreadsheet_id, batch_update_values_request_object = nil, quota_user: nil, fields: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::SheetsV4::BatchUpdateValuesResponse
Sets values in one or more ranges of a spreadsheet. The caller must specify the spreadsheet ID, a valueInputOption, and one or more ValueRanges.
315 316 317 318 319 320 321 322 323 324 325 |
# File 'generated/google/apis/sheets_v4/service.rb', line 315 def batch_update_values(spreadsheet_id, batch_update_values_request_object = nil, quota_user: nil, fields: nil, options: nil, &block) command = make_simple_command(:post, 'v4/spreadsheets/{spreadsheetId}/values:batchUpdate', ) command.request_representation = Google::Apis::SheetsV4::BatchUpdateValuesRequest::Representation command.request_object = batch_update_values_request_object command.response_representation = Google::Apis::SheetsV4::BatchUpdateValuesResponse::Representation command.response_class = Google::Apis::SheetsV4::BatchUpdateValuesResponse command.params['spreadsheetId'] = spreadsheet_id unless spreadsheet_id.nil? command.query['quotaUser'] = quota_user unless quota_user.nil? command.query['fields'] = fields unless fields.nil? execute_or_queue_command(command, &block) end |
#clear_values(spreadsheet_id, range, clear_values_request_object = nil, quota_user: nil, fields: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::SheetsV4::ClearValuesResponse
Clears values from a spreadsheet. The caller must specify the spreadsheet ID and range. Only values are cleared -- all other properties of the cell (such as formatting, data validation, etc..) are kept.
405 406 407 408 409 410 411 412 413 414 415 416 |
# File 'generated/google/apis/sheets_v4/service.rb', line 405 def clear_values(spreadsheet_id, range, clear_values_request_object = nil, quota_user: nil, fields: nil, options: nil, &block) command = make_simple_command(:post, 'v4/spreadsheets/{spreadsheetId}/values/{range}:clear', ) command.request_representation = Google::Apis::SheetsV4::ClearValuesRequest::Representation command.request_object = clear_values_request_object command.response_representation = Google::Apis::SheetsV4::ClearValuesResponse::Representation command.response_class = Google::Apis::SheetsV4::ClearValuesResponse command.params['spreadsheetId'] = spreadsheet_id unless spreadsheet_id.nil? command.params['range'] = range unless range.nil? command.query['quotaUser'] = quota_user unless quota_user.nil? command.query['fields'] = fields unless fields.nil? execute_or_queue_command(command, &block) end |
#copy_spreadsheet(spreadsheet_id, sheet_id, copy_sheet_to_another_spreadsheet_request_object = nil, quota_user: nil, fields: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::SheetsV4::SheetProperties
Copies a single sheet from a spreadsheet to another spreadsheet. Returns the properties of the newly created sheet.
548 549 550 551 552 553 554 555 556 557 558 559 |
# File 'generated/google/apis/sheets_v4/service.rb', line 548 def copy_spreadsheet(spreadsheet_id, sheet_id, copy_sheet_to_another_spreadsheet_request_object = nil, quota_user: nil, fields: nil, options: nil, &block) command = make_simple_command(:post, 'v4/spreadsheets/{spreadsheetId}/sheets/{sheetId}:copyTo', ) command.request_representation = Google::Apis::SheetsV4::CopySheetToAnotherSpreadsheetRequest::Representation command.request_object = copy_sheet_to_another_spreadsheet_request_object command.response_representation = Google::Apis::SheetsV4::SheetProperties::Representation command.response_class = Google::Apis::SheetsV4::SheetProperties command.params['spreadsheetId'] = spreadsheet_id unless spreadsheet_id.nil? command.params['sheetId'] = sheet_id unless sheet_id.nil? command.query['quotaUser'] = quota_user unless quota_user.nil? command.query['fields'] = fields unless fields.nil? execute_or_queue_command(command, &block) end |
#create_spreadsheet(spreadsheet_object = nil, quota_user: nil, fields: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::SheetsV4::Spreadsheet
Creates a spreadsheet, returning the newly created spreadsheet.
169 170 171 172 173 174 175 176 177 178 |
# File 'generated/google/apis/sheets_v4/service.rb', line 169 def create_spreadsheet(spreadsheet_object = nil, quota_user: nil, fields: nil, options: nil, &block) command = make_simple_command(:post, 'v4/spreadsheets', ) command.request_representation = Google::Apis::SheetsV4::Spreadsheet::Representation command.request_object = spreadsheet_object command.response_representation = Google::Apis::SheetsV4::Spreadsheet::Representation command.response_class = Google::Apis::SheetsV4::Spreadsheet command.query['quotaUser'] = quota_user unless quota_user.nil? command.query['fields'] = fields unless fields.nil? execute_or_queue_command(command, &block) end |
#get_spreadsheet(spreadsheet_id, include_grid_data: nil, ranges: nil, quota_user: nil, fields: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::SheetsV4::Spreadsheet
Returns the spreadsheet at the given ID. The caller must specify the spreadsheet ID. By default, data within grids will not be returned. You can include grid data one of two ways:
- Specify a field mask listing your desired fields using the
fieldsURL parameter in HTTP - Set the includeGridData
URL parameter to true. If a field mask is set, the
includeGridDataparameter is ignored For large spreadsheets, it is recommended to retrieve only the specific fields of the spreadsheet that you want. To retrieve only subsets of the spreadsheet, use the ranges URL parameter. Multiple ranges can be specified. Limiting the range will return only the portions of the spreadsheet that intersect the requested ranges. Ranges are specified using A1 notation.
90 91 92 93 94 95 96 97 98 99 100 |
# File 'generated/google/apis/sheets_v4/service.rb', line 90 def get_spreadsheet(spreadsheet_id, include_grid_data: nil, ranges: nil, quota_user: nil, fields: nil, options: nil, &block) command = make_simple_command(:get, 'v4/spreadsheets/{spreadsheetId}', ) command.response_representation = Google::Apis::SheetsV4::Spreadsheet::Representation command.response_class = Google::Apis::SheetsV4::Spreadsheet command.params['spreadsheetId'] = spreadsheet_id unless spreadsheet_id.nil? command.query['includeGridData'] = include_grid_data unless include_grid_data.nil? command.query['ranges'] = ranges unless ranges.nil? command.query['quotaUser'] = quota_user unless quota_user.nil? command.query['fields'] = fields unless fields.nil? execute_or_queue_command(command, &block) end |
#get_spreadsheet_values(spreadsheet_id, range, major_dimension: nil, date_time_render_option: nil, value_render_option: nil, quota_user: nil, fields: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::SheetsV4::ValueRange
Returns a range of values from a spreadsheet. The caller must specify the spreadsheet ID and a range.
218 219 220 221 222 223 224 225 226 227 228 229 230 |
# File 'generated/google/apis/sheets_v4/service.rb', line 218 def get_spreadsheet_values(spreadsheet_id, range, major_dimension: nil, date_time_render_option: nil, value_render_option: nil, quota_user: nil, fields: nil, options: nil, &block) command = make_simple_command(:get, 'v4/spreadsheets/{spreadsheetId}/values/{range}', ) command.response_representation = Google::Apis::SheetsV4::ValueRange::Representation command.response_class = Google::Apis::SheetsV4::ValueRange command.params['spreadsheetId'] = spreadsheet_id unless spreadsheet_id.nil? command.params['range'] = range unless range.nil? command.query['majorDimension'] = major_dimension unless major_dimension.nil? command.query['dateTimeRenderOption'] = date_time_render_option unless date_time_render_option.nil? command.query['valueRenderOption'] = value_render_option unless value_render_option.nil? command.query['quotaUser'] = quota_user unless quota_user.nil? command.query['fields'] = fields unless fields.nil? execute_or_queue_command(command, &block) end |
#update_spreadsheet_value(spreadsheet_id, range, value_range_object = nil, response_value_render_option: nil, value_input_option: nil, response_date_time_render_option: nil, include_values_in_response: nil, quota_user: nil, fields: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::SheetsV4::UpdateValuesResponse
Sets values in a range of a spreadsheet. The caller must specify the spreadsheet ID, range, and a valueInputOption.
274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 |
# File 'generated/google/apis/sheets_v4/service.rb', line 274 def update_spreadsheet_value(spreadsheet_id, range, value_range_object = nil, response_value_render_option: nil, value_input_option: nil, response_date_time_render_option: nil, include_values_in_response: nil, quota_user: nil, fields: nil, options: nil, &block) command = make_simple_command(:put, 'v4/spreadsheets/{spreadsheetId}/values/{range}', ) command.request_representation = Google::Apis::SheetsV4::ValueRange::Representation command.request_object = value_range_object command.response_representation = Google::Apis::SheetsV4::UpdateValuesResponse::Representation command.response_class = Google::Apis::SheetsV4::UpdateValuesResponse command.params['spreadsheetId'] = spreadsheet_id unless spreadsheet_id.nil? command.params['range'] = range unless range.nil? command.query['responseValueRenderOption'] = response_value_render_option unless response_value_render_option.nil? command.query['valueInputOption'] = value_input_option unless value_input_option.nil? command.query['responseDateTimeRenderOption'] = response_date_time_render_option unless response_date_time_render_option.nil? command.query['includeValuesInResponse'] = include_values_in_response unless include_values_in_response.nil? command.query['quotaUser'] = quota_user unless quota_user.nil? command.query['fields'] = fields unless fields.nil? execute_or_queue_command(command, &block) end |