This project contains a sample script that uses a service account to authenticate against Google Spreadsheets in order to read the content's of a spreadsheet.
Start by creating a service account at the Google Developer Console:
- Enable it and create a project:
- At Credentials, create a service account:
- Keep defaults at the next form and click Create. Save the resulting private key file in a directory where your application can read it:
- Next, click on “Manage Service accounts”:
- Copy the email address of your service account:
- Grant permission to the service account to the spreadsheet:
- Read the contents of index.php and fill out the required variables. Then execute it with:
composer install
php index.php
You should see the raw contents of the spreadsheet.