google-apis-sheets_v4 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,765 @@
1
+ # Copyright 2020 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ require 'google/apis/core/base_service'
16
+ require 'google/apis/core/json_representation'
17
+ require 'google/apis/core/hashable'
18
+ require 'google/apis/errors'
19
+
20
+ module Google
21
+ module Apis
22
+ module SheetsV4
23
+ # Google Sheets API
24
+ #
25
+ # Reads and writes Google Sheets.
26
+ #
27
+ # @example
28
+ # require 'google/apis/sheets_v4'
29
+ #
30
+ # Sheets = Google::Apis::SheetsV4 # Alias the module
31
+ # service = Sheets::SheetsService.new
32
+ #
33
+ # @see https://developers.google.com/sheets/
34
+ class SheetsService < Google::Apis::Core::BaseService
35
+ # @return [String]
36
+ # API key. Your API key identifies your project and provides you with API access,
37
+ # quota, and reports. Required unless you provide an OAuth 2.0 token.
38
+ attr_accessor :key
39
+
40
+ # @return [String]
41
+ # Available to use for quota purposes for server-side applications. Can be any
42
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
43
+ attr_accessor :quota_user
44
+
45
+ def initialize
46
+ super('https://sheets.googleapis.com/', '',
47
+ client_name: 'google-apis-sheets_v4',
48
+ client_version: Google::Apis::SheetsV4::GEM_VERSION)
49
+ @batch_path = 'batch'
50
+ end
51
+
52
+ # Applies one or more updates to the spreadsheet. Each request is validated
53
+ # before being applied. If any request is not valid then the entire request will
54
+ # fail and nothing will be applied. Some requests have replies to give you some
55
+ # information about how they are applied. The replies will mirror the requests.
56
+ # For example, if you applied 4 updates and the 3rd one had a reply, then the
57
+ # response will have 2 empty replies, the actual reply, and another empty reply,
58
+ # in that order. Due to the collaborative nature of spreadsheets, it is not
59
+ # guaranteed that the spreadsheet will reflect exactly your changes after this
60
+ # completes, however it is guaranteed that the updates in the request will be
61
+ # applied together atomically. Your changes may be altered with respect to
62
+ # collaborator changes. If there are no collaborators, the spreadsheet should
63
+ # reflect your changes.
64
+ # @param [String] spreadsheet_id
65
+ # The spreadsheet to apply the updates to.
66
+ # @param [Google::Apis::SheetsV4::BatchUpdateSpreadsheetRequest] batch_update_spreadsheet_request_object
67
+ # @param [String] fields
68
+ # Selector specifying which fields to include in a partial response.
69
+ # @param [String] quota_user
70
+ # Available to use for quota purposes for server-side applications. Can be any
71
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
72
+ # @param [Google::Apis::RequestOptions] options
73
+ # Request-specific options
74
+ #
75
+ # @yield [result, err] Result & error if block supplied
76
+ # @yieldparam result [Google::Apis::SheetsV4::BatchUpdateSpreadsheetResponse] parsed result object
77
+ # @yieldparam err [StandardError] error object if request failed
78
+ #
79
+ # @return [Google::Apis::SheetsV4::BatchUpdateSpreadsheetResponse]
80
+ #
81
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
82
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
83
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
84
+ def batch_update_spreadsheet(spreadsheet_id, batch_update_spreadsheet_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
85
+ command = make_simple_command(:post, 'v4/spreadsheets/{spreadsheetId}:batchUpdate', options)
86
+ command.request_representation = Google::Apis::SheetsV4::BatchUpdateSpreadsheetRequest::Representation
87
+ command.request_object = batch_update_spreadsheet_request_object
88
+ command.response_representation = Google::Apis::SheetsV4::BatchUpdateSpreadsheetResponse::Representation
89
+ command.response_class = Google::Apis::SheetsV4::BatchUpdateSpreadsheetResponse
90
+ command.params['spreadsheetId'] = spreadsheet_id unless spreadsheet_id.nil?
91
+ command.query['fields'] = fields unless fields.nil?
92
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
93
+ execute_or_queue_command(command, &block)
94
+ end
95
+
96
+ # Creates a spreadsheet, returning the newly created spreadsheet.
97
+ # @param [Google::Apis::SheetsV4::Spreadsheet] spreadsheet_object
98
+ # @param [String] fields
99
+ # Selector specifying which fields to include in a partial response.
100
+ # @param [String] quota_user
101
+ # Available to use for quota purposes for server-side applications. Can be any
102
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
103
+ # @param [Google::Apis::RequestOptions] options
104
+ # Request-specific options
105
+ #
106
+ # @yield [result, err] Result & error if block supplied
107
+ # @yieldparam result [Google::Apis::SheetsV4::Spreadsheet] parsed result object
108
+ # @yieldparam err [StandardError] error object if request failed
109
+ #
110
+ # @return [Google::Apis::SheetsV4::Spreadsheet]
111
+ #
112
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
113
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
114
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
115
+ def create_spreadsheet(spreadsheet_object = nil, fields: nil, quota_user: nil, options: nil, &block)
116
+ command = make_simple_command(:post, 'v4/spreadsheets', options)
117
+ command.request_representation = Google::Apis::SheetsV4::Spreadsheet::Representation
118
+ command.request_object = spreadsheet_object
119
+ command.response_representation = Google::Apis::SheetsV4::Spreadsheet::Representation
120
+ command.response_class = Google::Apis::SheetsV4::Spreadsheet
121
+ command.query['fields'] = fields unless fields.nil?
122
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
123
+ execute_or_queue_command(command, &block)
124
+ end
125
+
126
+ # Returns the spreadsheet at the given ID. The caller must specify the
127
+ # spreadsheet ID. By default, data within grids will not be returned. You can
128
+ # include grid data one of two ways: * Specify a field mask listing your desired
129
+ # fields using the `fields` URL parameter in HTTP * Set the includeGridData URL
130
+ # parameter to true. If a field mask is set, the `includeGridData` parameter is
131
+ # ignored For large spreadsheets, it is recommended to retrieve only the
132
+ # specific fields of the spreadsheet that you want. To retrieve only subsets of
133
+ # the spreadsheet, use the ranges URL parameter. Multiple ranges can be
134
+ # specified. Limiting the range will return only the portions of the spreadsheet
135
+ # that intersect the requested ranges. Ranges are specified using A1 notation.
136
+ # @param [String] spreadsheet_id
137
+ # The spreadsheet to request.
138
+ # @param [Boolean] include_grid_data
139
+ # True if grid data should be returned. This parameter is ignored if a field
140
+ # mask was set in the request.
141
+ # @param [Array<String>, String] ranges
142
+ # The ranges to retrieve from the spreadsheet.
143
+ # @param [String] fields
144
+ # Selector specifying which fields to include in a partial response.
145
+ # @param [String] quota_user
146
+ # Available to use for quota purposes for server-side applications. Can be any
147
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
148
+ # @param [Google::Apis::RequestOptions] options
149
+ # Request-specific options
150
+ #
151
+ # @yield [result, err] Result & error if block supplied
152
+ # @yieldparam result [Google::Apis::SheetsV4::Spreadsheet] parsed result object
153
+ # @yieldparam err [StandardError] error object if request failed
154
+ #
155
+ # @return [Google::Apis::SheetsV4::Spreadsheet]
156
+ #
157
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
158
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
159
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
160
+ def get_spreadsheet(spreadsheet_id, include_grid_data: nil, ranges: nil, fields: nil, quota_user: nil, options: nil, &block)
161
+ command = make_simple_command(:get, 'v4/spreadsheets/{spreadsheetId}', options)
162
+ command.response_representation = Google::Apis::SheetsV4::Spreadsheet::Representation
163
+ command.response_class = Google::Apis::SheetsV4::Spreadsheet
164
+ command.params['spreadsheetId'] = spreadsheet_id unless spreadsheet_id.nil?
165
+ command.query['includeGridData'] = include_grid_data unless include_grid_data.nil?
166
+ command.query['ranges'] = ranges unless ranges.nil?
167
+ command.query['fields'] = fields unless fields.nil?
168
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
169
+ execute_or_queue_command(command, &block)
170
+ end
171
+
172
+ # Returns the spreadsheet at the given ID. The caller must specify the
173
+ # spreadsheet ID. This method differs from GetSpreadsheet in that it allows
174
+ # selecting which subsets of spreadsheet data to return by specifying a
175
+ # dataFilters parameter. Multiple DataFilters can be specified. Specifying one
176
+ # or more data filters will return the portions of the spreadsheet that
177
+ # intersect ranges matched by any of the filters. By default, data within grids
178
+ # will not be returned. You can include grid data one of two ways: * Specify a
179
+ # field mask listing your desired fields using the `fields` URL parameter in
180
+ # HTTP * Set the includeGridData parameter to true. If a field mask is set, the `
181
+ # includeGridData` parameter is ignored For large spreadsheets, it is
182
+ # recommended to retrieve only the specific fields of the spreadsheet that you
183
+ # want.
184
+ # @param [String] spreadsheet_id
185
+ # The spreadsheet to request.
186
+ # @param [Google::Apis::SheetsV4::GetSpreadsheetByDataFilterRequest] get_spreadsheet_by_data_filter_request_object
187
+ # @param [String] fields
188
+ # Selector specifying which fields to include in a partial response.
189
+ # @param [String] quota_user
190
+ # Available to use for quota purposes for server-side applications. Can be any
191
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
192
+ # @param [Google::Apis::RequestOptions] options
193
+ # Request-specific options
194
+ #
195
+ # @yield [result, err] Result & error if block supplied
196
+ # @yieldparam result [Google::Apis::SheetsV4::Spreadsheet] parsed result object
197
+ # @yieldparam err [StandardError] error object if request failed
198
+ #
199
+ # @return [Google::Apis::SheetsV4::Spreadsheet]
200
+ #
201
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
202
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
203
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
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)
205
+ command = make_simple_command(:post, 'v4/spreadsheets/{spreadsheetId}:getByDataFilter', options)
206
+ command.request_representation = Google::Apis::SheetsV4::GetSpreadsheetByDataFilterRequest::Representation
207
+ command.request_object = get_spreadsheet_by_data_filter_request_object
208
+ command.response_representation = Google::Apis::SheetsV4::Spreadsheet::Representation
209
+ command.response_class = Google::Apis::SheetsV4::Spreadsheet
210
+ command.params['spreadsheetId'] = spreadsheet_id unless spreadsheet_id.nil?
211
+ command.query['fields'] = fields unless fields.nil?
212
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
213
+ execute_or_queue_command(command, &block)
214
+ end
215
+
216
+ # Returns the developer metadata with the specified ID. The caller must specify
217
+ # the spreadsheet ID and the developer metadata's unique metadataId.
218
+ # @param [String] spreadsheet_id
219
+ # The ID of the spreadsheet to retrieve metadata from.
220
+ # @param [Fixnum] metadata_id
221
+ # The ID of the developer metadata to retrieve.
222
+ # @param [String] fields
223
+ # Selector specifying which fields to include in a partial response.
224
+ # @param [String] quota_user
225
+ # Available to use for quota purposes for server-side applications. Can be any
226
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
227
+ # @param [Google::Apis::RequestOptions] options
228
+ # Request-specific options
229
+ #
230
+ # @yield [result, err] Result & error if block supplied
231
+ # @yieldparam result [Google::Apis::SheetsV4::DeveloperMetadata] parsed result object
232
+ # @yieldparam err [StandardError] error object if request failed
233
+ #
234
+ # @return [Google::Apis::SheetsV4::DeveloperMetadata]
235
+ #
236
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
237
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
238
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
239
+ def get_spreadsheet_developer_metadatum(spreadsheet_id, metadata_id, fields: nil, quota_user: nil, options: nil, &block)
240
+ command = make_simple_command(:get, 'v4/spreadsheets/{spreadsheetId}/developerMetadata/{metadataId}', options)
241
+ command.response_representation = Google::Apis::SheetsV4::DeveloperMetadata::Representation
242
+ command.response_class = Google::Apis::SheetsV4::DeveloperMetadata
243
+ command.params['spreadsheetId'] = spreadsheet_id unless spreadsheet_id.nil?
244
+ command.params['metadataId'] = metadata_id unless metadata_id.nil?
245
+ command.query['fields'] = fields unless fields.nil?
246
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
247
+ execute_or_queue_command(command, &block)
248
+ end
249
+
250
+ # Returns all developer metadata matching the specified DataFilter. If the
251
+ # provided DataFilter represents a DeveloperMetadataLookup object, this will
252
+ # return all DeveloperMetadata entries selected by it. If the DataFilter
253
+ # represents a location in a spreadsheet, this will return all developer
254
+ # metadata associated with locations intersecting that region.
255
+ # @param [String] spreadsheet_id
256
+ # The ID of the spreadsheet to retrieve metadata from.
257
+ # @param [Google::Apis::SheetsV4::SearchDeveloperMetadataRequest] search_developer_metadata_request_object
258
+ # @param [String] fields
259
+ # Selector specifying which fields to include in a partial response.
260
+ # @param [String] quota_user
261
+ # Available to use for quota purposes for server-side applications. Can be any
262
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
263
+ # @param [Google::Apis::RequestOptions] options
264
+ # Request-specific options
265
+ #
266
+ # @yield [result, err] Result & error if block supplied
267
+ # @yieldparam result [Google::Apis::SheetsV4::SearchDeveloperMetadataResponse] parsed result object
268
+ # @yieldparam err [StandardError] error object if request failed
269
+ #
270
+ # @return [Google::Apis::SheetsV4::SearchDeveloperMetadataResponse]
271
+ #
272
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
273
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
274
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
275
+ def search_developer_metadatum_developer_metadata(spreadsheet_id, search_developer_metadata_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
276
+ command = make_simple_command(:post, 'v4/spreadsheets/{spreadsheetId}/developerMetadata:search', options)
277
+ command.request_representation = Google::Apis::SheetsV4::SearchDeveloperMetadataRequest::Representation
278
+ command.request_object = search_developer_metadata_request_object
279
+ command.response_representation = Google::Apis::SheetsV4::SearchDeveloperMetadataResponse::Representation
280
+ command.response_class = Google::Apis::SheetsV4::SearchDeveloperMetadataResponse
281
+ command.params['spreadsheetId'] = spreadsheet_id unless spreadsheet_id.nil?
282
+ command.query['fields'] = fields unless fields.nil?
283
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
284
+ execute_or_queue_command(command, &block)
285
+ end
286
+
287
+ # Copies a single sheet from a spreadsheet to another spreadsheet. Returns the
288
+ # properties of the newly created sheet.
289
+ # @param [String] spreadsheet_id
290
+ # The ID of the spreadsheet containing the sheet to copy.
291
+ # @param [Fixnum] sheet_id
292
+ # The ID of the sheet to copy.
293
+ # @param [Google::Apis::SheetsV4::CopySheetToAnotherSpreadsheetRequest] copy_sheet_to_another_spreadsheet_request_object
294
+ # @param [String] fields
295
+ # Selector specifying which fields to include in a partial response.
296
+ # @param [String] quota_user
297
+ # Available to use for quota purposes for server-side applications. Can be any
298
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
299
+ # @param [Google::Apis::RequestOptions] options
300
+ # Request-specific options
301
+ #
302
+ # @yield [result, err] Result & error if block supplied
303
+ # @yieldparam result [Google::Apis::SheetsV4::SheetProperties] parsed result object
304
+ # @yieldparam err [StandardError] error object if request failed
305
+ #
306
+ # @return [Google::Apis::SheetsV4::SheetProperties]
307
+ #
308
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
309
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
310
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
311
+ def copy_spreadsheet(spreadsheet_id, sheet_id, copy_sheet_to_another_spreadsheet_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
312
+ command = make_simple_command(:post, 'v4/spreadsheets/{spreadsheetId}/sheets/{sheetId}:copyTo', options)
313
+ command.request_representation = Google::Apis::SheetsV4::CopySheetToAnotherSpreadsheetRequest::Representation
314
+ command.request_object = copy_sheet_to_another_spreadsheet_request_object
315
+ command.response_representation = Google::Apis::SheetsV4::SheetProperties::Representation
316
+ command.response_class = Google::Apis::SheetsV4::SheetProperties
317
+ command.params['spreadsheetId'] = spreadsheet_id unless spreadsheet_id.nil?
318
+ command.params['sheetId'] = sheet_id unless sheet_id.nil?
319
+ command.query['fields'] = fields unless fields.nil?
320
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
321
+ execute_or_queue_command(command, &block)
322
+ end
323
+
324
+ # Appends values to a spreadsheet. The input range is used to search for
325
+ # existing data and find a "table" within that range. Values will be appended to
326
+ # the next row of the table, starting with the first column of the table. See
327
+ # the [guide](/sheets/api/guides/values#appending_values) and [sample code](/
328
+ # sheets/api/samples/writing#append_values) for specific details of how tables
329
+ # are detected and data is appended. The caller must specify the spreadsheet ID,
330
+ # range, and a valueInputOption. The `valueInputOption` only controls how the
331
+ # input data will be added to the sheet (column-wise or row-wise), it does not
332
+ # influence what cell the data starts being written to.
333
+ # @param [String] spreadsheet_id
334
+ # The ID of the spreadsheet to update.
335
+ # @param [String] range
336
+ # The A1 notation of a range to search for a logical table of data. Values are
337
+ # appended after the last row of the table.
338
+ # @param [Google::Apis::SheetsV4::ValueRange] value_range_object
339
+ # @param [Boolean] include_values_in_response
340
+ # Determines if the update response should include the values of the cells that
341
+ # were appended. By default, responses do not include the updated values.
342
+ # @param [String] insert_data_option
343
+ # How the input data should be inserted.
344
+ # @param [String] response_date_time_render_option
345
+ # Determines how dates, times, and durations in the response should be rendered.
346
+ # This is ignored if response_value_render_option is FORMATTED_VALUE. The
347
+ # default dateTime render option is [DateTimeRenderOption.SERIAL_NUMBER].
348
+ # @param [String] response_value_render_option
349
+ # Determines how values in the response should be rendered. The default render
350
+ # option is ValueRenderOption.FORMATTED_VALUE.
351
+ # @param [String] value_input_option
352
+ # How the input data should be interpreted.
353
+ # @param [String] fields
354
+ # Selector specifying which fields to include in a partial response.
355
+ # @param [String] quota_user
356
+ # Available to use for quota purposes for server-side applications. Can be any
357
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
358
+ # @param [Google::Apis::RequestOptions] options
359
+ # Request-specific options
360
+ #
361
+ # @yield [result, err] Result & error if block supplied
362
+ # @yieldparam result [Google::Apis::SheetsV4::AppendValuesResponse] parsed result object
363
+ # @yieldparam err [StandardError] error object if request failed
364
+ #
365
+ # @return [Google::Apis::SheetsV4::AppendValuesResponse]
366
+ #
367
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
368
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
369
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
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)
371
+ command = make_simple_command(:post, 'v4/spreadsheets/{spreadsheetId}/values/{range}:append', options)
372
+ command.request_representation = Google::Apis::SheetsV4::ValueRange::Representation
373
+ command.request_object = value_range_object
374
+ command.response_representation = Google::Apis::SheetsV4::AppendValuesResponse::Representation
375
+ command.response_class = Google::Apis::SheetsV4::AppendValuesResponse
376
+ command.params['spreadsheetId'] = spreadsheet_id unless spreadsheet_id.nil?
377
+ command.params['range'] = range unless range.nil?
378
+ command.query['includeValuesInResponse'] = include_values_in_response unless include_values_in_response.nil?
379
+ command.query['insertDataOption'] = insert_data_option unless insert_data_option.nil?
380
+ command.query['responseDateTimeRenderOption'] = response_date_time_render_option unless response_date_time_render_option.nil?
381
+ command.query['responseValueRenderOption'] = response_value_render_option unless response_value_render_option.nil?
382
+ command.query['valueInputOption'] = value_input_option unless value_input_option.nil?
383
+ command.query['fields'] = fields unless fields.nil?
384
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
385
+ execute_or_queue_command(command, &block)
386
+ end
387
+
388
+ # Clears one or more ranges of values from a spreadsheet. The caller must
389
+ # specify the spreadsheet ID and one or more ranges. Only values are cleared --
390
+ # all other properties of the cell (such as formatting, data validation, etc..)
391
+ # are kept.
392
+ # @param [String] spreadsheet_id
393
+ # The ID of the spreadsheet to update.
394
+ # @param [Google::Apis::SheetsV4::BatchClearValuesRequest] batch_clear_values_request_object
395
+ # @param [String] fields
396
+ # Selector specifying which fields to include in a partial response.
397
+ # @param [String] quota_user
398
+ # Available to use for quota purposes for server-side applications. Can be any
399
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
400
+ # @param [Google::Apis::RequestOptions] options
401
+ # Request-specific options
402
+ #
403
+ # @yield [result, err] Result & error if block supplied
404
+ # @yieldparam result [Google::Apis::SheetsV4::BatchClearValuesResponse] parsed result object
405
+ # @yieldparam err [StandardError] error object if request failed
406
+ #
407
+ # @return [Google::Apis::SheetsV4::BatchClearValuesResponse]
408
+ #
409
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
410
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
411
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
412
+ def batch_clear_values(spreadsheet_id, batch_clear_values_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
413
+ command = make_simple_command(:post, 'v4/spreadsheets/{spreadsheetId}/values:batchClear', options)
414
+ command.request_representation = Google::Apis::SheetsV4::BatchClearValuesRequest::Representation
415
+ command.request_object = batch_clear_values_request_object
416
+ command.response_representation = Google::Apis::SheetsV4::BatchClearValuesResponse::Representation
417
+ command.response_class = Google::Apis::SheetsV4::BatchClearValuesResponse
418
+ command.params['spreadsheetId'] = spreadsheet_id unless spreadsheet_id.nil?
419
+ command.query['fields'] = fields unless fields.nil?
420
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
421
+ execute_or_queue_command(command, &block)
422
+ end
423
+
424
+ # Clears one or more ranges of values from a spreadsheet. The caller must
425
+ # specify the spreadsheet ID and one or more DataFilters. Ranges matching any of
426
+ # the specified data filters will be cleared. Only values are cleared -- all
427
+ # other properties of the cell (such as formatting, data validation, etc..) are
428
+ # kept.
429
+ # @param [String] spreadsheet_id
430
+ # The ID of the spreadsheet to update.
431
+ # @param [Google::Apis::SheetsV4::BatchClearValuesByDataFilterRequest] batch_clear_values_by_data_filter_request_object
432
+ # @param [String] fields
433
+ # Selector specifying which fields to include in a partial response.
434
+ # @param [String] quota_user
435
+ # Available to use for quota purposes for server-side applications. Can be any
436
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
437
+ # @param [Google::Apis::RequestOptions] options
438
+ # Request-specific options
439
+ #
440
+ # @yield [result, err] Result & error if block supplied
441
+ # @yieldparam result [Google::Apis::SheetsV4::BatchClearValuesByDataFilterResponse] parsed result object
442
+ # @yieldparam err [StandardError] error object if request failed
443
+ #
444
+ # @return [Google::Apis::SheetsV4::BatchClearValuesByDataFilterResponse]
445
+ #
446
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
447
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
448
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
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)
450
+ command = make_simple_command(:post, 'v4/spreadsheets/{spreadsheetId}/values:batchClearByDataFilter', options)
451
+ command.request_representation = Google::Apis::SheetsV4::BatchClearValuesByDataFilterRequest::Representation
452
+ command.request_object = batch_clear_values_by_data_filter_request_object
453
+ command.response_representation = Google::Apis::SheetsV4::BatchClearValuesByDataFilterResponse::Representation
454
+ command.response_class = Google::Apis::SheetsV4::BatchClearValuesByDataFilterResponse
455
+ command.params['spreadsheetId'] = spreadsheet_id unless spreadsheet_id.nil?
456
+ command.query['fields'] = fields unless fields.nil?
457
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
458
+ execute_or_queue_command(command, &block)
459
+ end
460
+
461
+ # Returns one or more ranges of values from a spreadsheet. The caller must
462
+ # specify the spreadsheet ID and one or more ranges.
463
+ # @param [String] spreadsheet_id
464
+ # The ID of the spreadsheet to retrieve data from.
465
+ # @param [String] date_time_render_option
466
+ # How dates, times, and durations should be represented in the output. This is
467
+ # ignored if value_render_option is FORMATTED_VALUE. The default dateTime render
468
+ # option is [DateTimeRenderOption.SERIAL_NUMBER].
469
+ # @param [String] major_dimension
470
+ # The major dimension that results should use. For example, if the spreadsheet
471
+ # data is: `A1=1,B1=2,A2=3,B2=4`, then requesting `range=A1:B2,majorDimension=
472
+ # ROWS` returns `[[1,2],[3,4]]`, whereas requesting `range=A1:B2,majorDimension=
473
+ # COLUMNS` returns `[[1,3],[2,4]]`.
474
+ # @param [Array<String>, String] ranges
475
+ # The A1 notation of the values to retrieve.
476
+ # @param [String] value_render_option
477
+ # How values should be represented in the output. The default render option is
478
+ # ValueRenderOption.FORMATTED_VALUE.
479
+ # @param [String] fields
480
+ # Selector specifying which fields to include in a partial response.
481
+ # @param [String] quota_user
482
+ # Available to use for quota purposes for server-side applications. Can be any
483
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
484
+ # @param [Google::Apis::RequestOptions] options
485
+ # Request-specific options
486
+ #
487
+ # @yield [result, err] Result & error if block supplied
488
+ # @yieldparam result [Google::Apis::SheetsV4::BatchGetValuesResponse] parsed result object
489
+ # @yieldparam err [StandardError] error object if request failed
490
+ #
491
+ # @return [Google::Apis::SheetsV4::BatchGetValuesResponse]
492
+ #
493
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
494
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
495
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
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)
497
+ command = make_simple_command(:get, 'v4/spreadsheets/{spreadsheetId}/values:batchGet', options)
498
+ command.response_representation = Google::Apis::SheetsV4::BatchGetValuesResponse::Representation
499
+ command.response_class = Google::Apis::SheetsV4::BatchGetValuesResponse
500
+ command.params['spreadsheetId'] = spreadsheet_id unless spreadsheet_id.nil?
501
+ command.query['dateTimeRenderOption'] = date_time_render_option unless date_time_render_option.nil?
502
+ command.query['majorDimension'] = major_dimension unless major_dimension.nil?
503
+ command.query['ranges'] = ranges unless ranges.nil?
504
+ command.query['valueRenderOption'] = value_render_option unless value_render_option.nil?
505
+ command.query['fields'] = fields unless fields.nil?
506
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
507
+ execute_or_queue_command(command, &block)
508
+ end
509
+
510
+ # Returns one or more ranges of values that match the specified data filters.
511
+ # The caller must specify the spreadsheet ID and one or more DataFilters. Ranges
512
+ # that match any of the data filters in the request will be returned.
513
+ # @param [String] spreadsheet_id
514
+ # The ID of the spreadsheet to retrieve data from.
515
+ # @param [Google::Apis::SheetsV4::BatchGetValuesByDataFilterRequest] batch_get_values_by_data_filter_request_object
516
+ # @param [String] fields
517
+ # Selector specifying which fields to include in a partial response.
518
+ # @param [String] quota_user
519
+ # Available to use for quota purposes for server-side applications. Can be any
520
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
521
+ # @param [Google::Apis::RequestOptions] options
522
+ # Request-specific options
523
+ #
524
+ # @yield [result, err] Result & error if block supplied
525
+ # @yieldparam result [Google::Apis::SheetsV4::BatchGetValuesByDataFilterResponse] parsed result object
526
+ # @yieldparam err [StandardError] error object if request failed
527
+ #
528
+ # @return [Google::Apis::SheetsV4::BatchGetValuesByDataFilterResponse]
529
+ #
530
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
531
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
532
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
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)
534
+ command = make_simple_command(:post, 'v4/spreadsheets/{spreadsheetId}/values:batchGetByDataFilter', options)
535
+ command.request_representation = Google::Apis::SheetsV4::BatchGetValuesByDataFilterRequest::Representation
536
+ command.request_object = batch_get_values_by_data_filter_request_object
537
+ command.response_representation = Google::Apis::SheetsV4::BatchGetValuesByDataFilterResponse::Representation
538
+ command.response_class = Google::Apis::SheetsV4::BatchGetValuesByDataFilterResponse
539
+ command.params['spreadsheetId'] = spreadsheet_id unless spreadsheet_id.nil?
540
+ command.query['fields'] = fields unless fields.nil?
541
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
542
+ execute_or_queue_command(command, &block)
543
+ end
544
+
545
+ # Sets values in one or more ranges of a spreadsheet. The caller must specify
546
+ # the spreadsheet ID, a valueInputOption, and one or more ValueRanges.
547
+ # @param [String] spreadsheet_id
548
+ # The ID of the spreadsheet to update.
549
+ # @param [Google::Apis::SheetsV4::BatchUpdateValuesRequest] batch_update_values_request_object
550
+ # @param [String] fields
551
+ # Selector specifying which fields to include in a partial response.
552
+ # @param [String] quota_user
553
+ # Available to use for quota purposes for server-side applications. Can be any
554
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
555
+ # @param [Google::Apis::RequestOptions] options
556
+ # Request-specific options
557
+ #
558
+ # @yield [result, err] Result & error if block supplied
559
+ # @yieldparam result [Google::Apis::SheetsV4::BatchUpdateValuesResponse] parsed result object
560
+ # @yieldparam err [StandardError] error object if request failed
561
+ #
562
+ # @return [Google::Apis::SheetsV4::BatchUpdateValuesResponse]
563
+ #
564
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
565
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
566
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
567
+ def batch_update_values(spreadsheet_id, batch_update_values_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
568
+ command = make_simple_command(:post, 'v4/spreadsheets/{spreadsheetId}/values:batchUpdate', options)
569
+ command.request_representation = Google::Apis::SheetsV4::BatchUpdateValuesRequest::Representation
570
+ command.request_object = batch_update_values_request_object
571
+ command.response_representation = Google::Apis::SheetsV4::BatchUpdateValuesResponse::Representation
572
+ command.response_class = Google::Apis::SheetsV4::BatchUpdateValuesResponse
573
+ command.params['spreadsheetId'] = spreadsheet_id unless spreadsheet_id.nil?
574
+ command.query['fields'] = fields unless fields.nil?
575
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
576
+ execute_or_queue_command(command, &block)
577
+ end
578
+
579
+ # Sets values in one or more ranges of a spreadsheet. The caller must specify
580
+ # the spreadsheet ID, a valueInputOption, and one or more DataFilterValueRanges.
581
+ # @param [String] spreadsheet_id
582
+ # The ID of the spreadsheet to update.
583
+ # @param [Google::Apis::SheetsV4::BatchUpdateValuesByDataFilterRequest] batch_update_values_by_data_filter_request_object
584
+ # @param [String] fields
585
+ # Selector specifying which fields to include in a partial response.
586
+ # @param [String] quota_user
587
+ # Available to use for quota purposes for server-side applications. Can be any
588
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
589
+ # @param [Google::Apis::RequestOptions] options
590
+ # Request-specific options
591
+ #
592
+ # @yield [result, err] Result & error if block supplied
593
+ # @yieldparam result [Google::Apis::SheetsV4::BatchUpdateValuesByDataFilterResponse] parsed result object
594
+ # @yieldparam err [StandardError] error object if request failed
595
+ #
596
+ # @return [Google::Apis::SheetsV4::BatchUpdateValuesByDataFilterResponse]
597
+ #
598
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
599
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
600
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
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)
602
+ command = make_simple_command(:post, 'v4/spreadsheets/{spreadsheetId}/values:batchUpdateByDataFilter', options)
603
+ command.request_representation = Google::Apis::SheetsV4::BatchUpdateValuesByDataFilterRequest::Representation
604
+ command.request_object = batch_update_values_by_data_filter_request_object
605
+ command.response_representation = Google::Apis::SheetsV4::BatchUpdateValuesByDataFilterResponse::Representation
606
+ command.response_class = Google::Apis::SheetsV4::BatchUpdateValuesByDataFilterResponse
607
+ command.params['spreadsheetId'] = spreadsheet_id unless spreadsheet_id.nil?
608
+ command.query['fields'] = fields unless fields.nil?
609
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
610
+ execute_or_queue_command(command, &block)
611
+ end
612
+
613
+ # Clears values from a spreadsheet. The caller must specify the spreadsheet ID
614
+ # and range. Only values are cleared -- all other properties of the cell (such
615
+ # as formatting, data validation, etc..) are kept.
616
+ # @param [String] spreadsheet_id
617
+ # The ID of the spreadsheet to update.
618
+ # @param [String] range
619
+ # The A1 notation of the values to clear.
620
+ # @param [Google::Apis::SheetsV4::ClearValuesRequest] clear_values_request_object
621
+ # @param [String] fields
622
+ # Selector specifying which fields to include in a partial response.
623
+ # @param [String] quota_user
624
+ # Available to use for quota purposes for server-side applications. Can be any
625
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
626
+ # @param [Google::Apis::RequestOptions] options
627
+ # Request-specific options
628
+ #
629
+ # @yield [result, err] Result & error if block supplied
630
+ # @yieldparam result [Google::Apis::SheetsV4::ClearValuesResponse] parsed result object
631
+ # @yieldparam err [StandardError] error object if request failed
632
+ #
633
+ # @return [Google::Apis::SheetsV4::ClearValuesResponse]
634
+ #
635
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
636
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
637
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
638
+ def clear_values(spreadsheet_id, range, clear_values_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
639
+ command = make_simple_command(:post, 'v4/spreadsheets/{spreadsheetId}/values/{range}:clear', options)
640
+ command.request_representation = Google::Apis::SheetsV4::ClearValuesRequest::Representation
641
+ command.request_object = clear_values_request_object
642
+ command.response_representation = Google::Apis::SheetsV4::ClearValuesResponse::Representation
643
+ command.response_class = Google::Apis::SheetsV4::ClearValuesResponse
644
+ command.params['spreadsheetId'] = spreadsheet_id unless spreadsheet_id.nil?
645
+ command.params['range'] = range unless range.nil?
646
+ command.query['fields'] = fields unless fields.nil?
647
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
648
+ execute_or_queue_command(command, &block)
649
+ end
650
+
651
+ # Returns a range of values from a spreadsheet. The caller must specify the
652
+ # spreadsheet ID and a range.
653
+ # @param [String] spreadsheet_id
654
+ # The ID of the spreadsheet to retrieve data from.
655
+ # @param [String] range
656
+ # The A1 notation of the values to retrieve.
657
+ # @param [String] date_time_render_option
658
+ # How dates, times, and durations should be represented in the output. This is
659
+ # ignored if value_render_option is FORMATTED_VALUE. The default dateTime render
660
+ # option is [DateTimeRenderOption.SERIAL_NUMBER].
661
+ # @param [String] major_dimension
662
+ # The major dimension that results should use. For example, if the spreadsheet
663
+ # data is: `A1=1,B1=2,A2=3,B2=4`, then requesting `range=A1:B2,majorDimension=
664
+ # ROWS` returns `[[1,2],[3,4]]`, whereas requesting `range=A1:B2,majorDimension=
665
+ # COLUMNS` returns `[[1,3],[2,4]]`.
666
+ # @param [String] value_render_option
667
+ # How values should be represented in the output. The default render option is
668
+ # ValueRenderOption.FORMATTED_VALUE.
669
+ # @param [String] fields
670
+ # Selector specifying which fields to include in a partial response.
671
+ # @param [String] quota_user
672
+ # Available to use for quota purposes for server-side applications. Can be any
673
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
674
+ # @param [Google::Apis::RequestOptions] options
675
+ # Request-specific options
676
+ #
677
+ # @yield [result, err] Result & error if block supplied
678
+ # @yieldparam result [Google::Apis::SheetsV4::ValueRange] parsed result object
679
+ # @yieldparam err [StandardError] error object if request failed
680
+ #
681
+ # @return [Google::Apis::SheetsV4::ValueRange]
682
+ #
683
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
684
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
685
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
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)
687
+ command = make_simple_command(:get, 'v4/spreadsheets/{spreadsheetId}/values/{range}', options)
688
+ command.response_representation = Google::Apis::SheetsV4::ValueRange::Representation
689
+ command.response_class = Google::Apis::SheetsV4::ValueRange
690
+ command.params['spreadsheetId'] = spreadsheet_id unless spreadsheet_id.nil?
691
+ command.params['range'] = range unless range.nil?
692
+ command.query['dateTimeRenderOption'] = date_time_render_option unless date_time_render_option.nil?
693
+ command.query['majorDimension'] = major_dimension unless major_dimension.nil?
694
+ command.query['valueRenderOption'] = value_render_option unless value_render_option.nil?
695
+ command.query['fields'] = fields unless fields.nil?
696
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
697
+ execute_or_queue_command(command, &block)
698
+ end
699
+
700
+ # Sets values in a range of a spreadsheet. The caller must specify the
701
+ # spreadsheet ID, range, and a valueInputOption.
702
+ # @param [String] spreadsheet_id
703
+ # The ID of the spreadsheet to update.
704
+ # @param [String] range
705
+ # The A1 notation of the values to update.
706
+ # @param [Google::Apis::SheetsV4::ValueRange] value_range_object
707
+ # @param [Boolean] include_values_in_response
708
+ # Determines if the update response should include the values of the cells that
709
+ # were updated. By default, responses do not include the updated values. If the
710
+ # range to write was larger than the range actually written, the response
711
+ # includes all values in the requested range (excluding trailing empty rows and
712
+ # columns).
713
+ # @param [String] response_date_time_render_option
714
+ # Determines how dates, times, and durations in the response should be rendered.
715
+ # This is ignored if response_value_render_option is FORMATTED_VALUE. The
716
+ # default dateTime render option is DateTimeRenderOption.SERIAL_NUMBER.
717
+ # @param [String] response_value_render_option
718
+ # Determines how values in the response should be rendered. The default render
719
+ # option is ValueRenderOption.FORMATTED_VALUE.
720
+ # @param [String] value_input_option
721
+ # How the input data should be interpreted.
722
+ # @param [String] fields
723
+ # Selector specifying which fields to include in a partial response.
724
+ # @param [String] quota_user
725
+ # Available to use for quota purposes for server-side applications. Can be any
726
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
727
+ # @param [Google::Apis::RequestOptions] options
728
+ # Request-specific options
729
+ #
730
+ # @yield [result, err] Result & error if block supplied
731
+ # @yieldparam result [Google::Apis::SheetsV4::UpdateValuesResponse] parsed result object
732
+ # @yieldparam err [StandardError] error object if request failed
733
+ #
734
+ # @return [Google::Apis::SheetsV4::UpdateValuesResponse]
735
+ #
736
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
737
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
738
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
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)
740
+ command = make_simple_command(:put, 'v4/spreadsheets/{spreadsheetId}/values/{range}', options)
741
+ command.request_representation = Google::Apis::SheetsV4::ValueRange::Representation
742
+ command.request_object = value_range_object
743
+ command.response_representation = Google::Apis::SheetsV4::UpdateValuesResponse::Representation
744
+ command.response_class = Google::Apis::SheetsV4::UpdateValuesResponse
745
+ command.params['spreadsheetId'] = spreadsheet_id unless spreadsheet_id.nil?
746
+ command.params['range'] = range unless range.nil?
747
+ command.query['includeValuesInResponse'] = include_values_in_response unless include_values_in_response.nil?
748
+ command.query['responseDateTimeRenderOption'] = response_date_time_render_option unless response_date_time_render_option.nil?
749
+ command.query['responseValueRenderOption'] = response_value_render_option unless response_value_render_option.nil?
750
+ command.query['valueInputOption'] = value_input_option unless value_input_option.nil?
751
+ command.query['fields'] = fields unless fields.nil?
752
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
753
+ execute_or_queue_command(command, &block)
754
+ end
755
+
756
+ protected
757
+
758
+ def apply_command_defaults(command)
759
+ command.query['key'] = key unless key.nil?
760
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
761
+ end
762
+ end
763
+ end
764
+ end
765
+ end