0

I'm trying to create a dropdown menu in Google sheets using the PHP API, but not having an luck and unable to source any examples

There is an accepted answer at How to set validation method in Google spreadsheets API

but it fails at the final command

$result = $service->spreadsheets->batchUpdate($fileId, $bodyReq);

with:

     "error": {
        "code": 400,
        "message": "Invalid value at 'requests.set_data_validation.range.sheet_id' (TYPE_INT32), 
\"1sEoQb5TVYSWHByiDNWGF6B....\""

If anyone has a working example it would be greatly appreciated.

Athira
  • 1,177
  • 3
  • 13
  • 35
  • I think that providing the value of `$bodyReq` will help users think of your issue and the solution. – Tanaike Aug 01 '19 at 05:49

1 Answers1

0

For anyone finding this later, the confusion is that

$range->setSheetId(YOUR_SHEET_ID); //replace this by your sheet ID

is expecting an integer relating to the ID of the actual sheet, not the Spreadsheet ID - in this case 0.

How to find the Sheet ID