Skip to content

whiteoctober/SpreadsheetToJson

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

SpreadsheetToJson

A handy tool for converting Google Spreadsheets into Json data

Setup

To use this tool you'll need to create a Google Developer account at https://console.developers.google.com and also require a service account inside of the console.

Inside of Google Developer Console you'll first need to create a new project. Once your project has been created, make sure that is selected. Inside of the 'Api & Auth' section, on the left, select 'Apis'. Inside of here you should see a section titled 'Google Apps API's', from here select 'Drive API and enable it.

Once this is done you need setup some credentials to access the Google API's. Head to the 'Api & Auth' section and select'credentials'. You'll now be asked to generate your credentials, from the drop down menu select 'service account', this will take you to the next screen where you must choose 'p12'. This is important as the program will not work with the Json format.

Once you apply the p12 selection a file will download to your machine, place this file inside of your project. You will also need to grab the email address that was generated with your other credentials.

Once you have all your Google Developer account information you now need to get access to the spreadsheets on your auto-generated email address. You will need to ask the owner to share the file with your email address via the spreadsheet menu.

Using the tool

Using the tool is simple. Create an object of SpreadsheetToJson with an optional application name and then call the generateSpreadsheetData function passing in your P12 file, your auto-generated email under 'credentials' and the full url to the spreadsheet.

$spreadsheetJson = new SpreadsheetToJson($optionalApplicationName);
$spreadsheetJson->generateSpreadsheetData($nameOfYourP12File, $yourAutoGeneratedCredentialEmail, $fullUrlToSpreadsheet );

About

A handy tool for converting Google Spreadsheets into Json data

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages