google-api-php-client

Location of Google Drive Service Account Uploads

两盒软妹~` 提交于 2020-02-21 18:27:23
问题 I'm trying to upload a file to my Google Drive using a service account. When I deploy this code, I don't want the user to give authorization, I want them to upload to my account. I'm using this via PHP, and below is where I am so far. This code is based on the examples given by the official documentation. When I run the php script, I get no errors, and I print_r the result variable. It has multiple URLs, when I go to it with the same account I created all this with, it says I need to request

How to insert a column in Google spreadsheet?

房东的猫 提交于 2020-01-31 17:27:51
问题 I want to add new data to the start (beginning) of the sheet. So I have to add a new column A1 to the sheet. But I can't find any API example with PHP. Now I am appending the data with this: $body = new Google_Service_Sheets_ValueRange(['values' => $values]); $result = $service->spreadsheets_values->append($new_sheet_id, 'A1:E1', $body, $options); // appent the data to the spreadsheet Thanks. UPD: here is what I have found /* insert columns */ $requests = new Google_Service_Sheets_Request

How to insert a column in Google spreadsheet?

不羁的心 提交于 2020-01-31 17:25:49
问题 I want to add new data to the start (beginning) of the sheet. So I have to add a new column A1 to the sheet. But I can't find any API example with PHP. Now I am appending the data with this: $body = new Google_Service_Sheets_ValueRange(['values' => $values]); $result = $service->spreadsheets_values->append($new_sheet_id, 'A1:E1', $body, $options); // appent the data to the spreadsheet Thanks. UPD: here is what I have found /* insert columns */ $requests = new Google_Service_Sheets_Request

Get cell format information from Google Sheets using PHP

本秂侑毒 提交于 2020-01-25 07:08:17
问题 I'm reading values from Google Sheets using google-api-php-client and google-api-php-client-services libraries this way: $service = new \Google_Service_Sheets($this->calendarService->getClient()); $spreadsheetId = 'abhslJcKXjIqS8bAJ1lojekXuOk0WOSrdtVtJ2C512jQ'; $range = 'Sheet Name'; $response = $service->spreadsheets_values->get($spreadsheetId, $range); $values = $response->getValues(); // returns all cells as array How can I get information on format of each cell? (eg. number, date, email

Get cell format information from Google Sheets using PHP

别来无恙 提交于 2020-01-25 07:06:50
问题 I'm reading values from Google Sheets using google-api-php-client and google-api-php-client-services libraries this way: $service = new \Google_Service_Sheets($this->calendarService->getClient()); $spreadsheetId = 'abhslJcKXjIqS8bAJ1lojekXuOk0WOSrdtVtJ2C512jQ'; $range = 'Sheet Name'; $response = $service->spreadsheets_values->get($spreadsheetId, $range); $values = $response->getValues(); // returns all cells as array How can I get information on format of each cell? (eg. number, date, email

Download using Google Drive API NO ERROR but NOT RESULT

放肆的年华 提交于 2020-01-24 21:27:51
问题 I'm trying to download a file using this link. I made some modification. But when I'm trying to run the file, it does not give me error but no result too. It can get the downloadUrl of the file and it also satisfies this condition: if ($httpRequest->getResponseHttpCode() == 200) { echo "i'm here.."; return $httpRequest->getResponseBody(); } What am I missing here? How to process this returned value? Thanks in advance! 回答1: Use version 2 of the API, there is a PHP example there you can use.

PHP Google Sheets API - Permission Denied

爷,独闯天下 提交于 2020-01-24 12:38:08
问题 Hi I've just started to study PHP and I'm attempting to use the Google sheets API. I thought I followed their instructions and I could call and edit sheet data well but only Public Access. When I change access status as private or Group, I encounter message below. PHP Fatal error: Uncaught exception 'Google_Service_Exception' with message '{ "error": { "code": 403, "message": "The caller does not have permission", "errors": [ { "message": "The caller does not have permission", "domain":

Correct date formatting for a Google Calendar Event

烈酒焚心 提交于 2020-01-24 09:44:05
问题 I'm trying to create an event for Google Calendar and I'm getting this error : Invalid value for: "T" found, can only parse bare date string: 2013-08-22T16:00:00 I also tried adding the timezone offset to my string but I set the timezone manually in the EventDateTime object and according to the documentation it's not neccesary. Here is how I create my time string : data['start'] = $("#inputDateStart").val() + "T" + $("#inputTimeStart").val(); And how I set this string in my object $start =

How to set validation method in Google spreadsheets API

大城市里の小女人 提交于 2020-01-21 09:55:47
问题 I am confused about the new Google Sheets API v4. My question is: how can I set validation rules for specified column(s) in spreadsheet? There is no useful tutorial with description how to use appropriate methods. Result should look like following sample: That validation should be set before data upload (which works fine). My current code: $client = getClient(); $service = new Google_Service_Sheets($client); $fileId = 'my-document-id'; $body = new Google_Service_Sheets

Issue with Google-API-PHP Client, getting error when running the quick start script

 ̄綄美尐妖づ 提交于 2020-01-20 06:05:59
问题 I am facing an issue with quickstart php script here: https://developers.google.com/drive/v2/web/quickstart/php When I run the script first time, it executes perfectly and the access token is stored in a file called: drive-php-quickstart.json When I run the script second time, it gives me the error: Error start: Notice: Undefined index: expires_in in \google-api-php-client\src\Google\Client.php on line 485 Fatal error: Uncaught exception 'LogicException' with message 'refresh token must be