Using google sheet v4 API, bactchUpdate insertDimesion doesn't seem to work when inheritBefore is specified
https://developers.google.com/sheets/samples/rowcolumn#insert_an_empty_row_or_column
sheets.spreadsheets.batchUpdate({
spreadsheetId: config.SPREAD_SHEET_ID,
resource: {
requests: [
// {
// appendDimension: {
// sheetId: config.SHEET_ID,
// dimension: 'ROWS',
// length: all_rows - max_rows
// }
// }
{
"insertDimension": {
"range": {
"sheetId": config.SHEET_ID,
"dimension": "ROWS",
"startIndex": max_rows,
"endIndex": all_rows - max_rows
},
"inheritBefore": true
}
}
]
}
}, callback);
An error is received with follow message
Invalid JSON payload received. Unknown name "inherit_before" at 'requests[0].insert_dimension': Cannot find field.
While appendDimesion works fine.
Looks like this is actual API's issue, not the libraries' issue though?
Just solved my own problem, the example is using the wrong field name, it should be
"inheritFromBefore": true
not
"inheritBefore": true
As shown in https://developers.google.com/sheets/reference/rest/v4/spreadsheets/request#insertdimensionrequest
Most helpful comment
Just solved my own problem, the example is using the wrong field name, it should be
"inheritFromBefore": true
not
"inheritBefore": true
As shown in https://developers.google.com/sheets/reference/rest/v4/spreadsheets/request#insertdimensionrequest