Access Google Sheet by Python
Step 1: Go to Google API Console
Step 2: Add New Project
Click the inverted triangle on the top bar and then create the new project.
Step 3: Search Google Sheet API
Step 4: After creating the Google Sheet API, choose the Credentials from the left bar and then click CREATE CREDENTIALS and finally choose Service account
Step 5: Create Service Account
Step 6: After creating the JSON type key, then it will automatically download it to the local. Next action is to open the JSON file, and then find the key “client_email” and copy that value. Afterward, go to the google sheet you want to work via API and share the sheet with the value(mail) you copied from the JSON file.
Step 7: Run the code
For the “allwks_key” in the code snippet, it’s from the google sheet url link. For example, https://docs.google.com/spreadsheets/d/ xxxxx/edit#gid=ooo ,then xxxxx is the key.
The above is the step by step of getting the Google sheet value via Google Sheet API. If there is anything unclear or this article can improve, don’t hesitate to leave the message. :)