/google-spreadsheet-reader

Reads data from a Google Spreadsheet that requires authentication

Primary LanguagePHPMIT LicenseMIT

Google Spreadsheet Reader

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.

Installation

Start by creating a service account at the Google Developer Console:

  1. Open https://console.developers.google.com/apis/library

Console homepage

  1. Enable it and create a project:

Enable sheets

  1. At Credentials, create a service account:

Create service account

  1. Keep defaults at the next form and click Create. Save the resulting private key file in a directory where your application can read it:

Fill out form

  1. Next, click on “Manage Service accounts”:

Manage service sccounts

  1. Copy the email address of your service account:

Copy service account email

  1. Grant permission to the service account to the spreadsheet:

Share with service account

  1. 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.