From service.batch_update_spreadsheet([{ 'wrapStrategy': 'WRAP' }])
and I want to change all cells from my sheet.
, I guessed that your goal is as follows.
- You want to reflect
'wrapStrategy': 'WRAP'
to a sheet in a Google Spreadsheet using googleapis for ruby.
- You have already been able to get and put values to Google Spreadsheet with Sheets API.
In this case, how about the following sample script?
Sample script:
spreadsheet_id = '###' # Please set your Spreadsheet ID.
sheet_id = '###' # Please set your sheet ID.
request_body = {
requests: [{repeat_cell: {
range: {
sheet_id: sheet_id,
},
cell: {
user_entered_format: {
wrap_strategy: 'WRAP'
}
},
fields: 'userEnteredFormat.wrapStrategy'
}}]
}
service.batch_update_spreadsheet(spreadsheet_id, request_body, {})
When this script is run, the wrapStrategy of sheet_id
is set as WRAP
.
In this case, please use the snake case for the keys instead of the camel case. Please be careful about this.
Note:
- In this sample script, it supposes that your client of
service
can be used for updating the spreadsheet. Please be careful about this.
References: