GoogleシートAPIを使用してスプレッドシート(ID)からすべてのシートを取得しようとしました。 RESTメソッドが見つかりませんでした。Values.getから複数の範囲をリクエストすると、範囲エラーを解析できません
私のコードは$範囲の
$range[]= 'sheet1!A:C';
$response = $service->spreadsheets_values->get($spreadsheetId, $range);
$values = $response->getValues();
配列や文字列だけであれば一つの値を作品です。 MLTI値を持つ アレイは、RESTに悪いのURLを与える:
$range[]= 'sheet1!A:C';
$range[]= 'SHEET2!A:C';
$response = $service->spreadsheets_values->get($spreadsheetId, $range);
次のエラーが返されます。
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
おかげ