0

I am using below code to call Google Sheet API

$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_ID>"; $spreadsheet = $service->spreadsheets->get($spreadsheetId); $range = 'Sheet1'; $response = $service->spreadsheets_values->get($spreadsheetId, $range); 

and getting below response

{ "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, } 
1
  • There seem to be multiple reasons that can cause this with that API and service. Please see the linked question and detail in your question how it is different from the existing material on site (that are likely more related questions) Commented Feb 1 at 17:25

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.