Connecting to Google Sheets
Last updated
Last updated
The Google Developer Console UI changes often, so it may be different that what is explained below. If that is the case, feel free to submit an issue or reach out on our discord server and we'll get this page a lift.
sheetwork interacts with Google Spreadsheet via the gspread package/API. While you do not need to install it (it has been taken care of earlier when you installed sheetwork via pip), you will need to make sure you have enabled API Access for your project on the Google Developer Platform.
There are a number of ways in which you can set/get those. The easiest is probably to use Signed Credentials
Head to Google Developers Console and create a new project (or select an existing one)
Hit the menu and head to "API & Services > Library"
search for "Google Drive API", hit it and click "Enable It"
back to the menu above, or search for "Sheets API", hit it and click "Enable It"
Make sure you enable API access (see above)
Go to "APIs & Services > Credentials"
Hit "Create Credentials". Follow the instructions.
At some point you will be prompted to "Create a key". Do it and choose ".json" as the output.
A download will be initiated. If you open it, it will look something like you see below. Check the last section of this page to see what to do with that file.
If you use Google Sheets inside of an organisation and want to make sure that you access sheets on behalf of your user you can use this authentication method. When you use this method, sheetwork will ask the end user to grant access to the sheet's data.
Enable API access for a project (See above)
Go to "API & Services" > "Oauth Consent Screen". Click "Configure Consent Screen". Follow the instructions on the screen. You probably don't really need to change much from the defaults other than giving your application a name, which in that case could be sheetwork
you like really.
Go to "API & Services" > "Credentials", Click the "Create Credentials" button at the top then select "OAuth client ID".
Select "Desktop app" from the dropdown, give a name to your credentials (anything you like) and click "Create". Make sure you hit "OK" in the "OAuth client created" popup that may come up.
Download the credentials you just created by clicking the "Download JSON" button in "OAuth 2.0 Client IDs"
Check the section below.
sheetwork expects you to place your credentials file in a specific location:
Rename your file to correspond to your sheetwork project name. In the previous step we chose to call it my_sheetwork_project
so in that case your file should be renamed my_sheetwork_project.json
Move your renamed file to the folder we created two steps above.
Next, we'll set up your profile.yml
file which contains: a link to your google credentials as well as your database credentials.