A quick Google app script to add an export facility from Google Sheets to an Amazon Web Services S3 bucket.
The script turns a Google spreadsheet into JSON data and exports it to a bucket in your S3 account using a library built by Erik Schultink.
#Here's how to use it:
- On a spreadsheet, go to "Tools" and select "Script editor..."
- In the new window, save your script as whatever name.
- Click "Resources" and select "Libraries..."
- Enter the following library code for Schultink's S3 binding in "Find a Library" and click "Select".
- MB4837UymyETXyn8cv3fNXZc9ncYTrHL9
- Select the most recent version from the dropdown for the S3 library and click "Save".
- Paste the gs3.gs code into you script window, replace the AccessKey and SecretKey placeholders with you AWS credentials and save, and set the "year" variable to the current year.
- You may edit the
s3.putObject(...);
statement to customize the directory you will write your spreadsheet to. - Refresh your spreadsheet and the "Publish Data" button should appear.
- Export your data (may have to authorize the app) and a dialog box will appear with the address where you can retrieve your JSON.
- Make sure to freeze your first row with column headers. (Highlight the row, select VIEW > FREEZE > 1 ROW.)
- Name your spreadsheet something unique with no spaces or special characters and beginning with a lowercase letter.