Donate. I desperately need donations to survive due to my health

Get paid by answering surveys Click here

Click here to donate

Remote/Work from Home jobs

How to remove multiple rows at once google spreadsheet API

I have spent several days trying to find a solution to my problem. I want to implement removal of duplicates from my google spreadsheet document.

I have studied a lot of examples and docs, but still cannot achieve a desired result.

I am using PHP for development. As far as it is just wrapper for API calls I will use json api examples.

I try to send a similar request

{
  "requests": [
    {
      "deleteDimension": {
        "range": {
          "sheetId": sheetId,
          "dimension": "ROWS",
          "startIndex": 0,
          "endIndex": 3
        }
      }
    },
    {
      "deleteDimension": {
        "range": {
          "sheetId": sheetId,
          "dimension": "ROWS",
          "startIndex": 22,
          "endIndex": 23
        }
      }
    },
    {
      "deleteDimension": {
        "range": {
          "sheetId": sheetId,
          "dimension": "ROWS",
          "startIndex": 164,
          "endIndex":165
        }
      }
    },
    {
      "deleteDimension": {
        "range": {
          "sheetId": sheetId,
          "dimension": "ROWS",
          "startIndex": 77,
          "endIndex": 79
        }
      }
    },
    ]
}

And send this request as batch update.

But even if it is executed successfully I cannot get desired result, it removes only a single range at best.

So my question is how to make this work? Or I cannot delete multiple ranges at once.

Thanks

Comments