I’m stuck trying to change the number of rows in my Google Sheet using the v4 API. I’ve been using updateDimensionProperties in a batch request, but it’s not doing anything. Here’s what I’ve tried:
Used URLFetchApp in Apps Script with a service account
Sent requests to the batch endpoint
Tried different dimensions (ROWS and COLUMNS)
Tested with various row counts (1,500 to 18,000)
Attempted on both empty and populated sheets
Checked multiple Google Sheets files
The API returns a 200 status, but the sheet size doesn’t change. Other batch requests work fine. I’m targeting the correct sheet (confirmed with other requests).
Am I missing something? Is updateDimensionProperties even the right way to change row count? I ended up using insertDimension instead, but I’m curious if there’s a better method.
hey emmad, i’ve had similar trubles. try switching to sheets.spreadsheets.batchUpdate and double-check your scope settings. updateDimensionProperties sometimes fails silently. using insertDimension works, but i think the batchUpdate route is more reliable. good luck!
I’ve been down this road before, and it can be frustrating. In my experience, updateDimensionProperties can be finicky. Have you tried using the sheets.spreadsheets.batchUpdate method instead? It’s generally more robust for these kinds of operations.
One thing that caught me out initially was the payload structure. Make sure you’re including the sheetId in your request, not just the spreadsheetId. Also, double-check that your dimension range is correctly specified.
If all else fails, insertDimension is a valid workaround, albeit less elegant. You might also consider using the append method if you’re just looking to add rows at the end of the sheet.
Lastly, don’t forget to verify your API quotas. Sometimes, seemingly unrelated issues can stem from hitting API limits. Hope this helps!