How to make Google API calls from inside Google Apps Scripts: https://developers.google.com/sheets/api/quickstart/apps-script
Step 1: Create the script
- Open Google Drive in your web browser.
- Click New > More > Google Apps Script.
- If Google Apps Script isn't listed, you can install it by clicking the Connect more apps option instead. Search for "Google Apps Script" and click the +CONNECT button. Click the OK button in the popup, click the X icon to close the dialog, and repeat the step above.
- If you are presented with a welcome screen, click Blank Project.
- Replace the contents of the script editor with the code at the end of this gist.