Google Sheets Data Source Integration Tutorial¶
In this tutorial, we will go trough all necessary steps to set up a Google Drive job.
Setting up a Google Service Account¶
- Go to Google Cloud Console and sign in with your Google account. If you do not have a Google Cloud project, create one by clicking on "Select a project" and then "New Project".
- Click on "APIs & Services" in the sidebar, search for "Google Sheets API" and enable it. Do the same thing for "Google Drive API". Return to the homepage after this step.
- Under "IAM & Admin" in the sidebar, select "Service Accounts" and click on "+ Create service account" to initiate the service account creation process. Fill out the form and create the account (make sure to select proper roles)
- Account that you have created will appear in the table on "Service Accounts" dashboard, select the account and navigate to "Keys" tab, select "Add Key" followed by "Create new key" option, the "Key type" should be "JSON". Selecting "Create" will create the key and will prompt you to download the json file. Make sure to download it as you will need this later.
Warning
Navigate to a google drive that you want to use as a storage for reprots from CxReports and share it with the email of the Google Service Account that you have created.
Setting up Google Service Account in CxReports¶
- After logging in, navigate to "Google Drive" option under "Workspace Configuration" in the navigation menu and click on "+ Add New Service Account"
- Fill out the form with necessary information:
- Name: Name of the Google Service Account within the CxReports environment
- Email: Email of the Google Service Account that you have created in the first step of this tutorial
- Scopes: Enable the scopes (both Google Sheets and Google Drive will be enabled/disabled simultaneously)
- Key (JSON): Copy and Paste the contents of the JSON key that you have downloaded during the first step of this tutorial
- Select "Save"
Setting up a Google Drive job¶
- Navigate to "Jobs" section within "Workspace Configuration"
- Go through the wizard until you reach "Delivery" section. For more information, consult Emails section
- Select "Add Google Drive"
- From the dropdown select "Google Account", the one you have previously created
- Add "Folder Id" - you can find it by navigating to the folder within Google Drive that you want to use and copy the ID from the url. Example: https://drive.google.com/drive/u/0/folders/1lcVUmXDIXRgcA00UNeLJyJhPXkPYKMMg
- Optionally, add the "Subfolder Path" - this option will create a subfolder within the Google Drive folder. For example, you can use {[new Date()]:dt;YYYYMMMdd} to create a subfolder with a current date