ODBC guide

Execute sheet actions (delete rows / columns)


Executes a batch update request on a sheet to delete specific row ranges. This example calls the batch_update_request endpoint with two deleteDimension operations to remove rows 10–20 and 50–60. You can adapt the JSON body for other actions such as formatting, copy, paste, or merge.

Use tab ID 0 for the first tab, or the gid from the sheet URL for other tabs; set the spreadsheet ID to the sheet you want to update.

SELECT * FROM batch_update_request
WITH(
  Body='{
  "requests": [
    {
      "deleteDimension": {
        "range": {
          "sheetId": 0,
          "dimension": "ROWS",
          "startIndex": 10,
          "endIndex": 20
        }
      }
    },
    {
      "deleteDimension": {
        "range": {
          "sheetId": 0,
          "dimension": "ROWS",
          "startIndex": 50,
          "endIndex": 60
        }
      }
    }
  ]
}',
  TabId='0',  -- 0 = first tab
  SpreadSheetId='1az2H8ZYk7BvjddVTqPR-LfDjX9IRpIpjCDpFPe9EzkU'
)