Google Sheets API V4 - Autofill Error - No grid wi

2019-08-17 23:51发布

问题:

I am trying to make an AutoFillRequest using a SourceAndDestination object to describe the area to autofill. I've tested autofill requests using a GridRange object and everything works fine, but can't seem to get the SourceAndDestination working. Here is an example where I'm trying to autofill down the first row for 2 more rows.

HTTP POST

https://sheets.googleapis.com/v4/spreadsheets/{spreadsheetId}:batchUpdate

Request Body

{
  "requests": [
    {
      "autoFill": {
        "sourceAndDestination": {
          "dimension": "ROWS",
          "fillLength": 2,
          "source": {
            "sheetId": 1150108545,
            "endRowIndex": 1,
            "startRowIndex": 0
          }
        },
        "useAlternateSeries": false
      }
    }
  ]
}

The response has an error code 400:

message = "Invalid requests[0].autoFill: No grid with id: 0" status = "INVALID_ARGUMENT"

回答1:

Sorry about that, this was a bug on the server. It's now fixed, so the above should work.