0

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"

Steven M. Mortimer
  • 1,618
  • 14
  • 36

1 Answers1

2

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

Sam Berlin
  • 3,603
  • 12
  • 23
  • 1
    @StevenMortimer -- I forget exactly when the fix rolled out, but the original code should work now. – Sam Berlin May 11 '17 at 15:49
  • I'm experiencing this bug, but only with certain spreadsheets. With some spreadsheets, m exact same code works. With others, the exact same code comes back with: 'Invalid requests[0].addFilterView: No grid with id: 2'. I've verified multiple sources that there is a sheet with an index/id of 2. Can anyone look to see if this bug is occuring again? – Matt Nov 05 '21 at 19:47