I am trying to create multiple named ranges from a list spreadsheet ID's and sheet ID's. I am using the Sheets API batchUpdate method to define the named range parameters.
My requirement is to create named ranges for the entire columns (A:B) and not with row number boundations (A1:B1000).
The issue I am having is that even though I am not specifying a startRowIndex and an endRowIndex, the function is not creating a named range for the entire column (A:B), rather the named range which is created is bounded by row numbers (A1:B1000).
As per the documentation, the way to refer to entire columns in a GridRange is to not specify startRowIndex and endRowIndex, but this does not seem to work with addNamedRange request.
Please let me know if I am doing something wrong or if there is any other method to create a named range for whole columns.
I've also tried it with the setNamedRange method from SpreadsheetApp but the result is the same.
Here is my code :
ssid is the spreadsheet ID and sid is the sheet ID.
Sheets.Spreadsheets.batchUpdate(
{"requests": [{
"addNamedRange": {
"namedRange": {
"name": "Named Range",
"range": {
"sheetId": sid,
"startColumnIndex": 0,
"endColumnIndex": 1,
},
}
}
}]}
,ssid)