Using Google Apps Script to generate chart images
- Google Account
- Ruby environment (Google App Script can be called from any other)
- Go to my drive
- NEW -> Google Apps Script (you may need to authorize this 'app' to your Drive)
- Give a name to project
- Copy Code.gs to your Code.gs file
- GO TO on Publish -> Deploy as API executable
- Describe version
- Choose access to script
- Only myself: you will have to authorize Google App with account that owns script to have access to this script
- Anyone: you can own script with Account 1 and authorize Google that will execute script with any other Google Account
- Deploy
- GO TO Resource -> Cloud Platform project Google creates cloud project that is connected to your script by default. You can change project by entering project number in Change Project section
- GO TO Cloud platform project connected to script
- GO TO APIs & service -> Library -> Find "Google Apps Script Execution API" and enable it
- GO TO APIs & service -> Credentials ->
- Create Credentials -> OAuth client ID -> Choose Other -> Create
- Download json of that credentials
- Rename json file to clients-secret.json and move it to same folder where is located ruby file
- gem install google-api-client
- Download file charts-generator.rb
- Change SCRIPT_ID, line 12 (Can be found in Google Apps Script file, File -> Project properties)
Run ruby generate.rb
- Google Apps Script execution limitation - 6 min duration
- Script Execution API executions per 100 seconds - 1,500
- Script Execution API executions per day - unlimited
Feel free to fork this repo! Have fun!
To see more capabilities of Google Apps Script check this link
To see more about Google Charts check this link