Deleting rows in a google sheet using API and BatchUpdateRequest
<p>I'm attempting to send a BatchUpdateRequest to the Google Sheets API so that I can delete a row of data from a spreadsheet. My request looks like this:</p>

<pre><code>    var spreadsheetId = '1EV8S8AaAmxF3vP0F6RWxKIUlvF6uFEmsrOFWA1oNBYI';
    var requests = [];
    requests.push({
      "deleteDimension": {
        "range": {
          "sheetId": spreadsheetId,
          "dimension": "ROWS",
          "startIndex": 2,
          "endIndex": 3
        }
      }
    });
    var batchUpdateRequest = {requests: requests}
    var test = auth;
    sheets.spreadsheets.batchUpdate({
      auth: test,
      spreadsheetId: spreadsheetId,
      resource: batchUpdateRequest
    }, function(err, response) {
      if (err) {
        console.log('The API returned an error: ' + err);
        return;
      }
    });

  }
</code></pre>

<p>and the error it returns is: <code>The API returned an error: Error: Invalid value at 'requests[0].delete_dimension.range.sheet_id' (TYPE_INT32), "1EV8S8AaAmxF3vP0F6RWxKIUlvF6uFEmsrOFWA1oNBYI"</code></p>

<p>I've attempted to use <a href="https://developers.google.com/sheets/reference/rest/v4/spreadsheets/batchUpdate" rel="nofollow noreferrer">the "Try It!" section</a>  from google and <a href="https://developers.google.com/sheets/guides/batchupdate#example" rel="nofollow noreferrer">the "Updating Spreadsheets" section</a> from google to troubleshoot what's happening and I can't figure out if I'm missing something or getting a syntax error.</p>

<p>The error the "Try It" page gives me when I try to test it there gives me this:</p>

<pre><code>{
"error": {
  "code": 400,
  "message": "Invalid JSON payload received. Expected , or ] after array value.\n   \"deleteDimension\": {\n          \"range\n                    ^",
  "status": "INVALID_ARGUMENT"
}
}
</code></pre>