Я использую ниже код, чтобы вызвать Google Sheet Api < /p>
$client = new \Google_Client();
$client->setApplicationName('Google Sheets API');
$client->setScopes([\Google_Service_Sheets::SPREADSHEETS]);
$path = public_path('google_spreadhsheet/credentials.json');
$client->setAuthConfig($path);
$service = new \Google_Service_Sheets($client);
$spreadsheetId = "";
$spreadsheet = $service->spreadsheets->get($spreadsheetId);
$range = 'Sheet1';
$response = $service->spreadsheets_values->get($spreadsheetId, $range);
< /code>
и получение ниже ответа < /p>
{
"message": "{\n \"error\": {\n \"code\": 403,\n \"message\": \"The caller does not have permission\",\n \"errors\": [\n {\n \"message\": \"The caller does not have permission\",\n \"domain\": \"global\",\n \"reason\": \"forbidden\"\n }\n ],\n \"status\": \"PERMISSION_DENIED\"\n }\n}\n",
"exception": "Google\\Service\\Exception",
"file": "/var/www/html/vendor/google/apiclient/src/Http/REST.php",
"line": 134,
}
Подробнее здесь: https://stackoverflow.com/questions/794 ... permission
Ошибка API Google Sheets - у абонента нет разрешения ⇐ Php
-
- Похожие темы
- Ответы
- Просмотры
- Последнее сообщение