I try to get all the sheet from a spreadsheet(ID) with the Google Sheets API, I haven't found the REST method to do that.
My code is
$range[]= 'sheet1!A:C'; $response = $service->spreadsheets_values->get($spreadsheetId, $range); $values = $response->getValues(); Array or string for $range works only if one value. Array with mlti value give a bad url in REST:
$range[]= 'sheet1!A:C'; $range[]= 'SHEET2!A:C'; $response = $service->spreadsheets_values->get($spreadsheetId, $range); Returns the following Error:
Fatal error: Uncaught exception 'Google_Service_Exception' with message 'Error calling GET https://sheets.googleapis.com/v4/spreadsheets/[spreadsheetID]/values/Config%21A%3AC,Carte%21A%3AC?key=[my api key]: (400) Unable to parse range: sheet1!A:C,SHEET2!A:C' in C:\Program Files\EasyPHP-12.1\www...\src\Google\Http\REST.php:110 Stack trace: #0 C:\Program Files\EasyPHP-12.1\www...\src\Google\Http\REST.php(62): Google_Http_REST::decodeHttpResponse(Object(Google_Http_Request), Object(Google_Client)) #1 [internal function]: Google_Http_REST::doExecute(Object(Google_Client), Object(Google_Http_Request)) #2 C:\Program Files\EasyPHP-12.1\www...\src\Google\Task\Runner.php(174): call_user_func_array(Array, Array) #3 C:\Program Files\EasyPHP-12.1\www....\src\Google\Http\REST.php(46): Google_Task_Runner->run() #4 C:\Program Files\EasyPHP-12.1\www...\src\Google\Client.php(593): Google_Http_REST::execute(Object(Google_Client in C:\Program Files\EasyPHP-12.1\www...\src\Google\Http\REST.php on line 110
Thanks