This article will cover the process required to create an API connection to Google Sheets, as well as how to turn that Google Sheets data into a data set that can be used to build charts/dashboards.
You can also download these instructions in PDF format here:
Google Sheets API Connection.pdf
Connecting the Google Sheets API
Begin by logging into the iDashboards Data Hub and select the API Accounts option from the System drop down menu.
You will now see a new screen that shows you the API Accounts options as well as any existing API connections you might have already configured. Click the Add Account button.
Now select the Google Sheets option and click Login.
Log into your Google account and follow the steps below:
Open a new tab and go to https://console.developers.google.com/
In the Google API Dashboard, click Enable APIs and Services:
Search for the Google Sheets and Google Drive APIs, and click enable for each:
Select Credentials from the left hand navigation.
Open the Create credentials dropdown and choose OAuth client ID.
Under Application type choose Web Application.
Use the following Settings:
- Name - "iDashboards Data Hub" (or other descriptive name)
- Authorized redirect URIs - Use the "Redirect URL" value from the Add Account dialog in the iDashboards Data Hub. However, unless this URL includes a top level domain (.com, .org, etc) you will need to use ‘localhost’ in place of your server/PC name.
A dialog will open with the Client ID and Client Secret copy and paste those values into the appropriate field in the Add Account dialog in the iDashboards Data Hub.
Click Log in and choose your account in the new window.
You will now see the Account Created Successfully window. Close this window and go back to the Data Hub and refresh the page.
You will now see the newly created Google Sheets account available in the Data Hub window.
Creating a New Data Set
You have completed adding your Google Sheets API connection. From here you are now ready to proceed to creating a new data set in the ETL tool. First create a new Data Set:
Select Cloud API and choose the Google Sheets option.
In the next window, find and select the Google sheet you would like to use, and select either the entire sheet, a named range within the sheet, or a custom range that you can define via cell range.
Once you have selected the data range you want to use, you will have the option to define the data type for each column or use the detected type. Make any necessary changes and click Save.
You will now see a summary of your Data Set, along with options to add Parameters or define your column names.
After you’ve made any necessary changes, click Save As, give your Data Set a name, and then click Close.
Your Data Set is now available in the Data Hub, but in order to make it available as a Data Source for Dashboard/Chart design, we’ll need to format it with an ETL job.
Creating a New ETL Job
From the Data Hub main page, click ETL, followed by New ETL Job at the top of the screen, or just click the NEW ETL JOB button.
Once in the ETL canvas, click the ‘E’ box in the upper left hand corner and drag and drop it anywhere on the canvas to start an ‘Extract Data’ operation.
Hover over the ‘Extract Data’ box and click the gear. This will open a window where you can select the Data Set that was created earlier. Click open and an Extract Data dialogue box will open. Click save.
Now create a ‘Load Data into Table’ operation by dragging and dropping the ‘L’ box anywhere onto the canvas.
Then, hover over the Extract Data box, click the arrow and connect it to the Load Data into Table box. Hover over the Load Data into Table box and click the gear to configure the Load operation to save the data to a table in your database.
Click Create a Target Table from Input, select your datastore, and then Select a Schema, in this case dbo.
Give the Table a name and click Create:
Verify your details in the next window and click Save.
Now you can run your ETL job by clicking the play button in the upper right hand corner. Once that is done, click Save or Save As to save this ETL job for the future.
Your Google Sheets data is now available as a data source that can be used to create a chart in the main iDashboards user application.
Creating a New Chart
Log into the main user application and right click on any dashboard and select New Chart. In the Data Set section find your Datastore and select it from the list, followed by the data set table you created in the ETL tool and click Next.
Now, select the columns you want to use in your chart and click Next.
Choose your chart type and click Finish. You will now see your new chart filled with your Google Sheets data.