Google Sheets API v4 updateDimensionProperties fails to modify sheet dimensions in batch operations

I’m trying to modify the row count in a Google Sheet using the v4 API but running into issues. Originally wanted to use updateDimensionProperties but it’s not working at all. Google’s AI suggested this method but I’m starting to think it might be wrong. Eventually switched to insertDimension which worked, but still curious if updateDimensionProperties should actually work for changing row counts.

The Problem

My updateDimensionProperties calls return successful responses but nothing actually changes in the sheet. Using Apps Script with URLFetchApp and a service account for authentication.

API Endpoint:

https://sheets.googleapis.com/v4/spreadsheets/SHEET_ID:batchUpdate

Request Configuration:

{
  "headers": {"Authorization": "Bearer ACCESS_TOKEN"},
  "method": "POST",
  "contentType": "application/json",
  "muteHttpExceptions": true,
  "payload": JSON.stringify({
    "requests": [{
      "updateDimensionProperties": {
        "range": {
          "sheetId": 0,
          "dimension": "ROWS",
          "startIndex": 0,
          "endIndex": 2000
        },
        "properties": {
          "hiddenByUser": false
        },
        "fields": "hiddenByUser"
      }
    }]
  })
}

The API returns 200 status codes but the sheet dimensions never change. I’ve tested with different row counts, tried COLUMNS instead of ROWS, tested on empty and populated sheets, and tried mixing with other batch operations that work fine.

Anyone know what I’m doing wrong here?

yeah, updateDimensionProperties is for changing visibility or size, not for adding or removing rows/cols. that’s likely why nothing’s happening. stick with insertDimension for adding rows or cols to sheets.

I ran into this same confusion with the Sheets API last year. updateDimensionProperties only modifies existing dimension properties - stuff like visibility, pixel size, or developer metadata. It can’t change the total number of rows or columns. You’re basically editing attributes of dimensions that already exist, not creating new ones. When you set hiddenByUser to false, you’re just unhiding previously hidden rows, not adding new ones. If you want to expand sheet dimensions, use insertDimension or appendDimension instead. The API docs really should be clearer about this - the method name makes it sound like it handles dimension counts.

The confusion comes from Google’s confusing terminology. updateDimensionProperties only modifies properties of existing dimensions - it doesn’t expand the sheet grid itself. To actually expand a Google Sheet, you need insertDimension or appendDimension. I learned this the hard way during a data migration project where I had to dynamically resize sheets. The method you used tries to modify things like visibility or row sizing, but only for rows that already exist in your current grid. So if you set endIndex to 2000 but your sheet only has 1000 rows, those extra 1000 rows don’t exist yet. The API processes your request fine but has nothing to actually modify beyond what’s already there. Google’s AI was technically right that the method exists, but it missed what you were actually trying to do.