Home » Google » Google Apps Script to Python

Google Apps Script to Python

  • by

This Fall I will be teaching high school math and also developing in Python for schoolytics.io. The most famous last words have to be “How hard can that be?” I have created a lot of projects in Google Apps Script

And literally hundreds more. What is great about Google Apps Script is that I can code in a browser. It is easy to distribute. I make a Google Sheets spreadsheet (or Google Slides or…) and use the Tools menu to open the “Script editor” and I add the Google Apps Script code there. It is based on JavaScript. (Want to learn to code, consider becoming a premium member). If I share the spreadsheet with someone, I distribute the code. Easy.

Making the Move to Python

Python is not JavaScript. For a comparison Russian is not French. My first challenge is … WHERE DO I CODE PYTHON? I have started a Google Doc to document what I am figuring out:

Clay Smith

I am incredibly blessed to be friends with Clay Smith and other amazing coders who are willing to help me with this journey. Clay adapted the Python Quickstart for Google Sheets to use in GCP (Google Cloud Platform).

Who Uses the Cloud?

So my goal has been to do the equivalent of SpreadsheetApp.create() from Google Apps Script in Python. Essentially what I want to do is make a Google Sheets spreadsheet appear in my Drive. I had installed PyCharm to code Python locally on my machine, but I am used to working in the cloud. So I am trying to get it to work in Google Cloud Project (GCP). I have talked with several people who kindly offered to help me and pretty much every single one said “huh, I never did it that way.” So I’m probably heading down the wrong path but I’ll exhaust everything I can learn first. I WILL BE AN OAuth EXPERT EVENTUALLY!

The Python Quickstart Guide for the Google Sheets API assumes that you are working on a local machine. Something Clay was able to figure out only after we spent over an hour trying to understand why the sample code was not working in GCP. See above for his adaptation of the QuickStart guide to use in GCP.

“Of course you realize, there are some steps not mentioned in the quickstart” – Adam Morris GDE

OH, I realize this… how does that help it be QUICK to start?


I can code and create projects in Google Apps Script and not need to do OAuth verification, which we can just rename as “My Nemesis.” Unfortunately, to use GCP you have to start by creating a project and setting up OAuth. So in the coming weeks OAuth will have to move into best friend territory.

Not Successful YET

I am not successful yet in creating a Google Sheets spreadsheet from Python in GCP. But you can find my progress on the Google Doc.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.