0
votes

I followed this guide: https://developers.google.com/sheets/quickstart/php and have a php file that seems to work through terminal on my mac that can read the sample Google sheet.

My question is how do I get this to work on a remote server where my webpage is located?

The guide seems to simply get me setup with a local test environment but I want to be able to read from a Google sheet on my hosts server. what is my next move?

1

1 Answers

-1
votes

Check the Reading & Writing Cell Values guide.

For example if you want to read from a single range you can use:

GET https://sheets.googleapis.com/v4/spreadsheets/spreadsheet_id/values/range

-sheetId is used frequently in the Sheets API to specify which sheet is being read or updated. In the Sheets UI, you can find the sheetId of the open sheet in the spreadsheet URL, as the value of the gid parameter. The following shows the structure of the URL and where sheetId can be found:

https://docs.google.com/spreadsheets/d/spreadsheetId/edit#gid=sheetId

When I did this ins JS REST call it looked something like this:

xhr.open('GET','https://sheets.googleapis.com/v4/spreadsheets/spreadsheetId/values/Sheet1!B3:B71', true);

Here, I'm trying to read values from B3 to B71. Read more on A1 notation about this.

To do this in PHP, check the php-google-spreadsheet-client.