Class: Google::Apis::SheetsV4::SheetsService

Inherits:
Core::BaseService
  • Object
show all
Defined in:
lib/google/apis/sheets_v4/service.rb

Overview

Google Sheets API

Reads and writes Google Sheets.

Examples:

require 'google/apis/sheets_v4'

Sheets = Google::Apis::SheetsV4 # Alias the module
service = Sheets::SheetsService.new

See Also:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeSheetsService

Returns a new instance of SheetsService.



45
46
47
48
49
50
# File 'lib/google/apis/sheets_v4/service.rb', line 45

def initialize
  super('https://sheets.googleapis.com/', '',
        client_name: 'google-apis-sheets_v4',
        client_version: Google::Apis::SheetsV4::GEM_VERSION)
  @batch_path = 'batch'
end

Instance Attribute Details

#keyString

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.

Returns:

  • (String)

    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 'lib/google/apis/sheets_v4/service.rb', line 38

def key
  @key
end

#quota_userString

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.

Returns:

  • (String)

    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 'lib/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, include_values_in_response: nil, insert_data_option: nil, response_date_time_render_option: nil, response_value_render_option: nil, value_input_option: nil, fields: nil, quota_user: 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.

Parameters:

  • spreadsheet_id (String)

    The ID of the spreadsheet to update.

  • range (String)

    The A1 notation of a range to search for a logical table of data. Values are appended after the last row of the table.

  • value_range_object (Google::Apis::SheetsV4::ValueRange) (defaults to: nil)
  • include_values_in_response (Boolean) (defaults to: nil)

    Determines if the update response should include the values of the cells that were appended. By default, responses do not include the updated values.

  • insert_data_option (String) (defaults to: nil)

    How the input data should be inserted.

  • response_date_time_render_option (String) (defaults to: nil)

    Determines how dates, times, and durations in the response should be rendered. This is ignored if response_value_render_option is FORMATTED_VALUE. The default dateTime render option is SERIAL_NUMBER.

  • response_value_render_option (String) (defaults to: nil)

    Determines how values in the response should be rendered. The default render option is FORMATTED_VALUE.

  • value_input_option (String) (defaults to: nil)

    How the input data should be interpreted.

  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • quota_user (String) (defaults to: nil)

    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.

  • options (Google::Apis::RequestOptions) (defaults to: nil)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:

  • (Google::Apis::ServerError)

    An error occurred on the server and the request can be retried

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
# File 'lib/google/apis/sheets_v4/service.rb', line 370

def append_spreadsheet_value(spreadsheet_id, range, value_range_object = nil, include_values_in_response: nil, insert_data_option: nil, response_date_time_render_option: nil, response_value_render_option: nil, value_input_option: nil, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:post, 'v4/spreadsheets/{spreadsheetId}/values/{range}:append', options)
  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['includeValuesInResponse'] = include_values_in_response unless include_values_in_response.nil?
  command.query['insertDataOption'] = insert_data_option unless insert_data_option.nil?
  command.query['responseDateTimeRenderOption'] = response_date_time_render_option unless response_date_time_render_option.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['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#batch_clear_values(spreadsheet_id, batch_clear_values_request_object = nil, fields: nil, quota_user: 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.

Parameters:

  • spreadsheet_id (String)

    The ID of the spreadsheet to update.

  • batch_clear_values_request_object (Google::Apis::SheetsV4::BatchClearValuesRequest) (defaults to: nil)
  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • quota_user (String) (defaults to: nil)

    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.

  • options (Google::Apis::RequestOptions) (defaults to: nil)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:

  • (Google::Apis::ServerError)

    An error occurred on the server and the request can be retried

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



412
413
414
415
416
417
418
419
420
421
422
# File 'lib/google/apis/sheets_v4/service.rb', line 412

def batch_clear_values(spreadsheet_id, batch_clear_values_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:post, 'v4/spreadsheets/{spreadsheetId}/values:batchClear', options)
  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['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#batch_get_spreadsheet_values(spreadsheet_id, date_time_render_option: nil, major_dimension: nil, ranges: nil, value_render_option: nil, fields: nil, quota_user: 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.

Parameters:

  • spreadsheet_id (String)

    The ID of the spreadsheet to retrieve data from.

  • date_time_render_option (String) (defaults to: nil)

    How dates, times, and durations should be represented in the output. This is ignored if value_render_option is FORMATTED_VALUE. The default dateTime render option is SERIAL_NUMBER.

  • major_dimension (String) (defaults to: nil)

    The major dimension that results should use. For example, if the spreadsheet data is: A1=1,B1=2,A2=3,B2=4, then requesting range=A1:B2,majorDimension= ROWS returns [[1,2],[3,4]], whereas requesting range=A1:B2,majorDimension= COLUMNS returns [[1,3],[2,4]].

  • ranges (Array<String>, String) (defaults to: nil)

    The A1 notation or R1C1 notation of the range to retrieve values from.

  • value_render_option (String) (defaults to: nil)

    How values should be represented in the output. The default render option is ValueRenderOption.FORMATTED_VALUE.

  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • quota_user (String) (defaults to: nil)

    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.

  • options (Google::Apis::RequestOptions) (defaults to: nil)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:

  • (Google::Apis::ServerError)

    An error occurred on the server and the request can be retried

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



496
497
498
499
500
501
502
503
504
505
506
507
508
# File 'lib/google/apis/sheets_v4/service.rb', line 496

def batch_get_spreadsheet_values(spreadsheet_id, date_time_render_option: nil, major_dimension: nil, ranges: nil, value_render_option: nil, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:get, 'v4/spreadsheets/{spreadsheetId}/values:batchGet', options)
  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['dateTimeRenderOption'] = date_time_render_option unless date_time_render_option.nil?
  command.query['majorDimension'] = major_dimension unless major_dimension.nil?
  command.query['ranges'] = ranges unless ranges.nil?
  command.query['valueRenderOption'] = value_render_option unless value_render_option.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#batch_spreadsheet_value_clear_by_data_filter(spreadsheet_id, batch_clear_values_by_data_filter_request_object = nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::SheetsV4::BatchClearValuesByDataFilterResponse

Clears one or more ranges of values from a spreadsheet. The caller must specify the spreadsheet ID and one or more DataFilters. Ranges matching any of the specified data filters will be cleared. Only values are cleared -- all other properties of the cell (such as formatting, data validation, etc..) are kept.

Parameters:

  • spreadsheet_id (String)

    The ID of the spreadsheet to update.

  • batch_clear_values_by_data_filter_request_object (Google::Apis::SheetsV4::BatchClearValuesByDataFilterRequest) (defaults to: nil)
  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • quota_user (String) (defaults to: nil)

    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.

  • options (Google::Apis::RequestOptions) (defaults to: nil)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:

  • (Google::Apis::ServerError)

    An error occurred on the server and the request can be retried

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



449
450
451
452
453
454
455
456
457
458
459
# File 'lib/google/apis/sheets_v4/service.rb', line 449

def batch_spreadsheet_value_clear_by_data_filter(spreadsheet_id, batch_clear_values_by_data_filter_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:post, 'v4/spreadsheets/{spreadsheetId}/values:batchClearByDataFilter', options)
  command.request_representation = Google::Apis::SheetsV4::BatchClearValuesByDataFilterRequest::Representation
  command.request_object = batch_clear_values_by_data_filter_request_object
  command.response_representation = Google::Apis::SheetsV4::BatchClearValuesByDataFilterResponse::Representation
  command.response_class = Google::Apis::SheetsV4::BatchClearValuesByDataFilterResponse
  command.params['spreadsheetId'] = spreadsheet_id unless spreadsheet_id.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#batch_spreadsheet_value_get_by_data_filter(spreadsheet_id, batch_get_values_by_data_filter_request_object = nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::SheetsV4::BatchGetValuesByDataFilterResponse

Returns one or more ranges of values that match the specified data filters. The caller must specify the spreadsheet ID and one or more DataFilters. Ranges that match any of the data filters in the request will be returned.

Parameters:

  • spreadsheet_id (String)

    The ID of the spreadsheet to retrieve data from.

  • batch_get_values_by_data_filter_request_object (Google::Apis::SheetsV4::BatchGetValuesByDataFilterRequest) (defaults to: nil)
  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • quota_user (String) (defaults to: nil)

    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.

  • options (Google::Apis::RequestOptions) (defaults to: nil)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:

  • (Google::Apis::ServerError)

    An error occurred on the server and the request can be retried

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



533
534
535
536
537
538
539
540
541
542
543
# File 'lib/google/apis/sheets_v4/service.rb', line 533

def batch_spreadsheet_value_get_by_data_filter(spreadsheet_id, batch_get_values_by_data_filter_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:post, 'v4/spreadsheets/{spreadsheetId}/values:batchGetByDataFilter', options)
  command.request_representation = Google::Apis::SheetsV4::BatchGetValuesByDataFilterRequest::Representation
  command.request_object = batch_get_values_by_data_filter_request_object
  command.response_representation = Google::Apis::SheetsV4::BatchGetValuesByDataFilterResponse::Representation
  command.response_class = Google::Apis::SheetsV4::BatchGetValuesByDataFilterResponse
  command.params['spreadsheetId'] = spreadsheet_id unless spreadsheet_id.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#batch_spreadsheet_value_update_by_data_filter(spreadsheet_id, batch_update_values_by_data_filter_request_object = nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::SheetsV4::BatchUpdateValuesByDataFilterResponse

Sets values in one or more ranges of a spreadsheet. The caller must specify the spreadsheet ID, a valueInputOption, and one or more DataFilterValueRanges.

Parameters:

  • spreadsheet_id (String)

    The ID of the spreadsheet to update.

  • batch_update_values_by_data_filter_request_object (Google::Apis::SheetsV4::BatchUpdateValuesByDataFilterRequest) (defaults to: nil)
  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • quota_user (String) (defaults to: nil)

    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.

  • options (Google::Apis::RequestOptions) (defaults to: nil)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:

  • (Google::Apis::ServerError)

    An error occurred on the server and the request can be retried

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



601
602
603
604
605
606
607
608
609
610
611
# File 'lib/google/apis/sheets_v4/service.rb', line 601

def batch_spreadsheet_value_update_by_data_filter(spreadsheet_id, batch_update_values_by_data_filter_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:post, 'v4/spreadsheets/{spreadsheetId}/values:batchUpdateByDataFilter', options)
  command.request_representation = Google::Apis::SheetsV4::BatchUpdateValuesByDataFilterRequest::Representation
  command.request_object = batch_update_values_by_data_filter_request_object
  command.response_representation = Google::Apis::SheetsV4::BatchUpdateValuesByDataFilterResponse::Representation
  command.response_class = Google::Apis::SheetsV4::BatchUpdateValuesByDataFilterResponse
  command.params['spreadsheetId'] = spreadsheet_id unless spreadsheet_id.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#batch_update_spreadsheet(spreadsheet_id, batch_update_spreadsheet_request_object = nil, fields: nil, quota_user: 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.

Parameters:

  • spreadsheet_id (String)

    The spreadsheet to apply the updates to.

  • batch_update_spreadsheet_request_object (Google::Apis::SheetsV4::BatchUpdateSpreadsheetRequest) (defaults to: nil)
  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • quota_user (String) (defaults to: nil)

    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.

  • options (Google::Apis::RequestOptions) (defaults to: nil)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:

  • (Google::Apis::ServerError)

    An error occurred on the server and the request can be retried

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



84
85
86
87
88
89
90
91
92
93
94
# File 'lib/google/apis/sheets_v4/service.rb', line 84

def batch_update_spreadsheet(spreadsheet_id, batch_update_spreadsheet_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:post, 'v4/spreadsheets/{spreadsheetId}:batchUpdate', options)
  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['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#batch_update_values(spreadsheet_id, batch_update_values_request_object = nil, fields: nil, quota_user: 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.

Parameters:

  • spreadsheet_id (String)

    The ID of the spreadsheet to update.

  • batch_update_values_request_object (Google::Apis::SheetsV4::BatchUpdateValuesRequest) (defaults to: nil)
  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • quota_user (String) (defaults to: nil)

    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.

  • options (Google::Apis::RequestOptions) (defaults to: nil)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:

  • (Google::Apis::ServerError)

    An error occurred on the server and the request can be retried

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



567
568
569
570
571
572
573
574
575
576
577
# File 'lib/google/apis/sheets_v4/service.rb', line 567

def batch_update_values(spreadsheet_id, batch_update_values_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:post, 'v4/spreadsheets/{spreadsheetId}/values:batchUpdate', options)
  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['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#clear_values(spreadsheet_id, range, clear_values_request_object = nil, fields: nil, quota_user: 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.

Parameters:

  • spreadsheet_id (String)

    The ID of the spreadsheet to update.

  • range (String)

    The A1 notation or R1C1 notation of the values to clear.

  • clear_values_request_object (Google::Apis::SheetsV4::ClearValuesRequest) (defaults to: nil)
  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • quota_user (String) (defaults to: nil)

    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.

  • options (Google::Apis::RequestOptions) (defaults to: nil)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:

  • (Google::Apis::ServerError)

    An error occurred on the server and the request can be retried

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



638
639
640
641
642
643
644
645
646
647
648
649
# File 'lib/google/apis/sheets_v4/service.rb', line 638

def clear_values(spreadsheet_id, range, clear_values_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:post, 'v4/spreadsheets/{spreadsheetId}/values/{range}:clear', options)
  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['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#copy_spreadsheet(spreadsheet_id, sheet_id, copy_sheet_to_another_spreadsheet_request_object = nil, fields: nil, quota_user: 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.

Parameters:

  • spreadsheet_id (String)

    The ID of the spreadsheet containing the sheet to copy.

  • sheet_id (Fixnum)

    The ID of the sheet to copy.

  • copy_sheet_to_another_spreadsheet_request_object (Google::Apis::SheetsV4::CopySheetToAnotherSpreadsheetRequest) (defaults to: nil)
  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • quota_user (String) (defaults to: nil)

    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.

  • options (Google::Apis::RequestOptions) (defaults to: nil)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:

  • (Google::Apis::ServerError)

    An error occurred on the server and the request can be retried

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



311
312
313
314
315
316
317
318
319
320
321
322
# File 'lib/google/apis/sheets_v4/service.rb', line 311

def copy_spreadsheet(spreadsheet_id, sheet_id, copy_sheet_to_another_spreadsheet_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:post, 'v4/spreadsheets/{spreadsheetId}/sheets/{sheetId}:copyTo', options)
  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['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#create_spreadsheet(spreadsheet_object = nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::SheetsV4::Spreadsheet

Creates a spreadsheet, returning the newly created spreadsheet.

Parameters:

  • spreadsheet_object (Google::Apis::SheetsV4::Spreadsheet) (defaults to: nil)
  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • quota_user (String) (defaults to: nil)

    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.

  • options (Google::Apis::RequestOptions) (defaults to: nil)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:

  • (Google::Apis::ServerError)

    An error occurred on the server and the request can be retried

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



115
116
117
118
119
120
121
122
123
124
# File 'lib/google/apis/sheets_v4/service.rb', line 115

def create_spreadsheet(spreadsheet_object = nil, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:post, 'v4/spreadsheets', options)
  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['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#get_spreadsheet(spreadsheet_id, include_grid_data: nil, ranges: nil, fields: nil, quota_user: 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 fields URL parameter in HTTP * Set the includeGridData URL parameter to true. If a field mask is set, the includeGridData parameter 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.

Parameters:

  • spreadsheet_id (String)

    The spreadsheet to request.

  • include_grid_data (Boolean) (defaults to: nil)

    True if grid data should be returned. This parameter is ignored if a field mask was set in the request.

  • ranges (Array<String>, String) (defaults to: nil)

    The ranges to retrieve from the spreadsheet.

  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • quota_user (String) (defaults to: nil)

    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.

  • options (Google::Apis::RequestOptions) (defaults to: nil)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:

  • (Google::Apis::ServerError)

    An error occurred on the server and the request can be retried

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



160
161
162
163
164
165
166
167
168
169
170
# File 'lib/google/apis/sheets_v4/service.rb', line 160

def get_spreadsheet(spreadsheet_id, include_grid_data: nil, ranges: nil, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:get, 'v4/spreadsheets/{spreadsheetId}', options)
  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['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#get_spreadsheet_by_data_filter(spreadsheet_id, get_spreadsheet_by_data_filter_request_object = nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::SheetsV4::Spreadsheet

Returns the spreadsheet at the given ID. The caller must specify the spreadsheet ID. This method differs from GetSpreadsheet in that it allows selecting which subsets of spreadsheet data to return by specifying a dataFilters parameter. Multiple DataFilters can be specified. Specifying one or more data filters will return the portions of the spreadsheet that intersect ranges matched by any of the filters. 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 fields URL parameter in HTTP * Set the includeGridData parameter to true. If a field mask is set, the includeGridData parameter is ignored For large spreadsheets, it is recommended to retrieve only the specific fields of the spreadsheet that you want.

Parameters:

  • spreadsheet_id (String)

    The spreadsheet to request.

  • get_spreadsheet_by_data_filter_request_object (Google::Apis::SheetsV4::GetSpreadsheetByDataFilterRequest) (defaults to: nil)
  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • quota_user (String) (defaults to: nil)

    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.

  • options (Google::Apis::RequestOptions) (defaults to: nil)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:

  • (Google::Apis::ServerError)

    An error occurred on the server and the request can be retried

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



204
205
206
207
208
209
210
211
212
213
214
# File 'lib/google/apis/sheets_v4/service.rb', line 204

def get_spreadsheet_by_data_filter(spreadsheet_id, get_spreadsheet_by_data_filter_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:post, 'v4/spreadsheets/{spreadsheetId}:getByDataFilter', options)
  command.request_representation = Google::Apis::SheetsV4::GetSpreadsheetByDataFilterRequest::Representation
  command.request_object = get_spreadsheet_by_data_filter_request_object
  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['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#get_spreadsheet_developer_metadatum(spreadsheet_id, metadata_id, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::SheetsV4::DeveloperMetadata

Returns the developer metadata with the specified ID. The caller must specify the spreadsheet ID and the developer metadata's unique metadataId.

Parameters:

  • spreadsheet_id (String)

    The ID of the spreadsheet to retrieve metadata from.

  • metadata_id (Fixnum)

    The ID of the developer metadata to retrieve.

  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • quota_user (String) (defaults to: nil)

    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.

  • options (Google::Apis::RequestOptions) (defaults to: nil)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:

  • (Google::Apis::ServerError)

    An error occurred on the server and the request can be retried

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



239
240
241
242
243
244
245
246
247
248
# File 'lib/google/apis/sheets_v4/service.rb', line 239

def get_spreadsheet_developer_metadatum(spreadsheet_id, , fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:get, 'v4/spreadsheets/{spreadsheetId}/developerMetadata/{metadataId}', options)
  command.response_representation = Google::Apis::SheetsV4::DeveloperMetadata::Representation
  command.response_class = Google::Apis::SheetsV4::DeveloperMetadata
  command.params['spreadsheetId'] = spreadsheet_id unless spreadsheet_id.nil?
  command.params['metadataId'] =  unless .nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#get_spreadsheet_values(spreadsheet_id, range, date_time_render_option: nil, major_dimension: nil, value_render_option: nil, fields: nil, quota_user: 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.

Parameters:

  • spreadsheet_id (String)

    The ID of the spreadsheet to retrieve data from.

  • range (String)

    The A1 notation or R1C1 notation of the range to retrieve values from.

  • date_time_render_option (String) (defaults to: nil)

    How dates, times, and durations should be represented in the output. This is ignored if value_render_option is FORMATTED_VALUE. The default dateTime render option is SERIAL_NUMBER.

  • major_dimension (String) (defaults to: nil)

    The major dimension that results should use. For example, if the spreadsheet data is: A1=1,B1=2,A2=3,B2=4, then requesting range=A1:B2,majorDimension= ROWS returns [[1,2],[3,4]], whereas requesting range=A1:B2,majorDimension= COLUMNS returns [[1,3],[2,4]].

  • value_render_option (String) (defaults to: nil)

    How values should be represented in the output. The default render option is FORMATTED_VALUE.

  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • quota_user (String) (defaults to: nil)

    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.

  • options (Google::Apis::RequestOptions) (defaults to: nil)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:

  • (Google::Apis::ServerError)

    An error occurred on the server and the request can be retried

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



686
687
688
689
690
691
692
693
694
695
696
697
698
# File 'lib/google/apis/sheets_v4/service.rb', line 686

def get_spreadsheet_values(spreadsheet_id, range, date_time_render_option: nil, major_dimension: nil, value_render_option: nil, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:get, 'v4/spreadsheets/{spreadsheetId}/values/{range}', options)
  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['dateTimeRenderOption'] = date_time_render_option unless date_time_render_option.nil?
  command.query['majorDimension'] = major_dimension unless major_dimension.nil?
  command.query['valueRenderOption'] = value_render_option unless value_render_option.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#search_developer_metadatum_developer_metadata(spreadsheet_id, search_developer_metadata_request_object = nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::SheetsV4::SearchDeveloperMetadataResponse

Returns all developer metadata matching the specified DataFilter. If the provided DataFilter represents a DeveloperMetadataLookup object, this will return all DeveloperMetadata entries selected by it. If the DataFilter represents a location in a spreadsheet, this will return all developer metadata associated with locations intersecting that region.

Parameters:

  • spreadsheet_id (String)

    The ID of the spreadsheet to retrieve metadata from.

  • search_developer_metadata_request_object (Google::Apis::SheetsV4::SearchDeveloperMetadataRequest) (defaults to: nil)
  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • quota_user (String) (defaults to: nil)

    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.

  • options (Google::Apis::RequestOptions) (defaults to: nil)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:

  • (Google::Apis::ServerError)

    An error occurred on the server and the request can be retried

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



275
276
277
278
279
280
281
282
283
284
285
# File 'lib/google/apis/sheets_v4/service.rb', line 275

def (spreadsheet_id,  = nil, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:post, 'v4/spreadsheets/{spreadsheetId}/developerMetadata:search', options)
  command.request_representation = Google::Apis::SheetsV4::SearchDeveloperMetadataRequest::Representation
  command.request_object = 
  command.response_representation = Google::Apis::SheetsV4::SearchDeveloperMetadataResponse::Representation
  command.response_class = Google::Apis::SheetsV4::SearchDeveloperMetadataResponse
  command.params['spreadsheetId'] = spreadsheet_id unless spreadsheet_id.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#update_spreadsheet_value(spreadsheet_id, range, value_range_object = nil, include_values_in_response: nil, response_date_time_render_option: nil, response_value_render_option: nil, value_input_option: nil, fields: nil, quota_user: 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.

Parameters:

  • spreadsheet_id (String)

    The ID of the spreadsheet to update.

  • range (String)

    The A1 notation of the values to update.

  • value_range_object (Google::Apis::SheetsV4::ValueRange) (defaults to: nil)
  • include_values_in_response (Boolean) (defaults to: nil)

    Determines if the update response should include the values of the cells that were updated. By default, responses do not include the updated values. If the range to write was larger than the range actually written, the response includes all values in the requested range (excluding trailing empty rows and columns).

  • response_date_time_render_option (String) (defaults to: nil)

    Determines how dates, times, and durations in the response should be rendered. This is ignored if response_value_render_option is FORMATTED_VALUE. The default dateTime render option is SERIAL_NUMBER.

  • response_value_render_option (String) (defaults to: nil)

    Determines how values in the response should be rendered. The default render option is FORMATTED_VALUE.

  • value_input_option (String) (defaults to: nil)

    How the input data should be interpreted.

  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • quota_user (String) (defaults to: nil)

    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.

  • options (Google::Apis::RequestOptions) (defaults to: nil)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:

  • (Google::Apis::ServerError)

    An error occurred on the server and the request can be retried

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
# File 'lib/google/apis/sheets_v4/service.rb', line 739

def update_spreadsheet_value(spreadsheet_id, range, value_range_object = nil, include_values_in_response: nil, response_date_time_render_option: nil, response_value_render_option: nil, value_input_option: nil, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:put, 'v4/spreadsheets/{spreadsheetId}/values/{range}', options)
  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['includeValuesInResponse'] = include_values_in_response unless include_values_in_response.nil?
  command.query['responseDateTimeRenderOption'] = response_date_time_render_option unless response_date_time_render_option.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['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end