Publish Real-Time Data from Google Sheets to PowerBI.com

Video connect google sheet to power bi

Imagine being able to seamlessly integrate your Google Sheets data with Power BI tools and dashboards. With the CData Power BI connector for Google Sheets, you can now publish your reports on PowerBI.com and set up automatic refreshing using Power BI Gateway.

Create a DSN

The installation of the Power BI connector creates a Data Source Name (DSN) called “CData Power BI Google Sheets”. This is the name that Power BI uses to establish a connection to the data source. Configure the DSN by filling in the required connection properties.

You can use the Microsoft ODBC Data Source Administrator to create a new DSN or configure (and rename) an existing DSN. Simply search for “ODBC Data Sources” in the Start menu. Make sure to run the ODBC Administrator that matches your Power BI Desktop installation (32 or 64-bit).

To connect to a spreadsheet, provide Google authentication and then set the connection property to the name or feed link of the spreadsheet. If you want to display a list of information about the spreadsheets in your Google Drive, execute a query against the Spreadsheets view after authenticating.

Please note that the ClientLogin protocol (username/password authentication) has been officially deprecated since April 20, 2012, and is no longer available. Instead, use the OAuth 2.0 authentication standard. To access Google APIs on behalf of individual users, you can use embedded credentials or register your own OAuth app.

OAuth also allows you to use a service account to authenticate on behalf of users in a Google Apps domain. To authenticate with a service account, you will need to register an application to obtain the OAuth JWT values.

Refer to the “Getting Started” chapter of the help documentation for connecting to Google Sheets from different types of accounts: Google accounts, Google Apps accounts, and accounts using two-step verification.

Get Data from Google Sheets

With the data source configured, follow the steps below to load data from Google Sheets tables into a dataset.

Select Tables and Views to Load

  1. Open Power BI Desktop and click on “Get Data” -> “CData Google Sheets”.
  2. Select “CData Power BI Google Sheets” from the “Data Source Name” menu and choose the import connectivity mode.
  3. Expand the “CData Power BI Google Sheets” folder, expand an associated schema folder, and select the tables.

Shape the Data

Use the Query Editor if you need more control over the query and query results before loading the data. Power BI detects column behavior from the Google Sheets metadata retrieved by the CData connector. In the Query Editor, you can perform actions such as filtering, summarizing, and sorting on the columns.

To open Query Editor, click on “Edit” in the Navigator window. Right-click on a row to filter rows. Right-click on a column header to perform actions such as:

  • Change column data types
  • Delete a column
  • Group by columns

Power BI records your query changes in the “Applied Steps” section, adjusting the underlying data retrieval query that is executed against Google Sheets remote data.

Load the Data

When you click “Load,” the connector executes the underlying query against Google Sheets.

Create Data Visualizations

After loading data from Google Sheets into Power BI, you can create data visualizations in the Report view by dragging fields from the Fields pane onto the canvas. Follow the steps below to create a pie chart:

  1. Select the pie chart icon in the Visualizations pane.
  2. Select a dimension from the Fields pane, e.g., “Delivery Country.”
  3. Select a measure from the Fields pane, e.g., “Order Price.”

You can modify sorting options by clicking on the “…” button for the chart. Sorting column selection and changing sort order options are displayed.

You can use both highlighting and filtering to focus on data. Filtering removes unwanted data from visualizations, while highlighting dims unwanted data. You can highlight fields by clicking on them.

You can apply filters at the page level, report level, or to a single visualization by dragging fields to the Filters pane. To filter on the value of a field, select one of the displayed values in the Filters pane.

Click “Refresh” to synchronize your report with any data changes.

Configure Data Refresh on PowerBI.com

Follow the steps below to set up automatic data refreshing via Power BI Gateway. The gateway allows the Power BI cloud service to connect to the DSN on your machine.

Select Gateway Mode

During the gateway installation, you must select a gateway mode:

  • Gateway (Personal Mode): Use the gateway in personal mode if you simply need to publish to PowerBI.com and refresh reports. The gateway runs under your Windows user account.
  • Gateway (formerly Enterprise): Use the default gateway if you’re using other Azure services that require a gateway. You also need the default gateway if multiple users need access to the gateway. You need a system DSN to connect via the default gateway. (System DSNs are accessible at the system level, while user DSNs can only be used by a specific user account.) You can use the “CData Power BI GoogleSheets” system DSN configured during the connector installation.

Configure Gateway (Personal Mode)

Publishing via the gateway in personal mode simply requires an installed gateway with access to custom connectors.

  1. Run the Power BI connector installer.
  2. Select the On-premises data gateway option (personal mode).
  3. Log in to the gateway.
  4. Name the gateway and specify a recovery key.
  5. In the “Connectors” section of the gateway settings, enable the custom data connectors option. You can also specify an alternate path to the custom data connector .pqx files. Note: Power BI CData connectors install .pqx files in the default folder, “Your Documents/Power BI Desktop/Custom Connectors.”

Configure Gateway

Publishing via the gateway requires an installed gateway with access to custom connectors and a configured connection to the Google Sheets DSN from PowerBI.com.

1. Configure the Gateway

Follow the steps below to configure the gateway on your machine:

  1. Run the Power BI connector installer.

  2. Select the On-premises data gateway option (recommended).

  3. Log in to the gateway.

  4. Name the gateway and specify a recovery key.

  5. In the “Connectors” step, choose a folder where the gateway will look for the CData Power BI connector. This article uses “C:/Users/PBIEgwService/Documents/Power BI Desktop/Custom Connectors.” Copy the CData connector .pqx files (found in “C:/Users/USERNAME/Documents/Power BI Desktop/Custom Connectors”) to the folder you configured.
    NOTE: The account configured for the service (NT SERVICE/PBIEgwService) must have access to the chosen folder. If necessary, you can change the service account in the “Service settings” section of the gateway installer.

  6. Confirm that the entry CData.PowerBI.GoogleSheets is displayed in the list in the “Connectors” section.

2. Connect to Google Sheets Data from PowerBI.com

  1. Add a data source to the gateway: Sign in to PowerBI.com, go to the Settings menu, select “Manage gateways,” and choose your gateway.
  2. Select the option to “Allow user’s custom data connectors to refresh through this gateway cluster.”
  3. Click “Apply” to save your changes.
  4. Click the option to add a data source to the gateway.
  5. In the “Data source settings” section, provide a name for the data source, and in the “Data source type” menu, select “CData Power BI Connector for Google Sheets.”
  6. In the displayed Data Source Name field, enter the system DSN: CData Power BI GoogleSheets.

Publish to PowerBI.com

You can now publish refreshable reports and their underlying datasets. Follow the steps below to publish and complete the data refresh configuration for a dataset.

  1. In Power BI Desktop, click on “Publish” in the Home ribbon to publish the report.

  2. On PowerBI.com, select the workspace where you uploaded the report.

  3. In the “Datasets” section, click the options menu for the Google Sheets dataset you created, then click “Settings.”

  4. Under the “Gateway Connection” section, enable the option to use a gateway and select your gateway. You may need to manually add the data source to the gateway:

    • Expand the gateway in the Actions column.
    • Click on the “Add Manually to Gateway” link.
    • In the “New Connection” form, set the “Connection Name,” set the “Data Source Name” to the same data source name as above (e.g., “CData PBI Google Sheets”), and set the “Authentication Method” to “Anonymous.”
    • Set the “Privacy Level” according to your needs and click “Create.”
  5. If you are using the gateway in personal mode, expand the “Data Source Credentials” node and click “Edit Credentials” -> “Sign In” (this step is not necessary if you are using the default gateway).

Refresh a Dataset

Refresh the dataset to provide up-to-the-minute data to your reports.

  • For manual refresh, open the options menu for the dataset from your workspace -> datasets and click “Refresh Now.”
  • For scheduled refreshes, open the options menu for the dataset from your workspace -> datasets and click “Schedule Refresh.” Enable the option to keep your data up to date. Specify the refresh frequency in the menus.
  • In the Report view, click “Refresh” to synchronize the report with the dataset while you work.

For more information on publishing and refreshing data from Google Sheets to Power BI, visit Crawlan.com. Now you can seamlessly integrate and visualize your Google Sheets data with PowerBI.com!

Related posts