Skip to main content

How to Import a Public Google Sheet into Count using pandas

G
Written by Grace Fraser
Updated this week

This method is the simplest way to bring data into Count, but it only works if your Google Sheet is publicly accessible.
​

Steps:

  1. Make Your Sheet Public: In Google Sheets, click the Share button in the top right corner. Under "General access," change the setting to "Anyone with the link."

  2. Get the Sheet Key: Open your Google Sheet. Look at the URL in your browser's address bar. It will look something like this:

    https://docs.google.com/spreadsheets/d/YOUR_SHEET_KEY/edit#gid=0

    Copy the long string of characters after /d/. This is your sheet key.
    ​

  3. Read the Sheet in Count: In your Count canvas, create a new Python cell and paste the following code, replacing YOUR_SHEET_KEY and YOUR_SHEET_NAME with your actual sheet key and the name of the specific sheet tab you want to import:

    Python

    import pandas as pd 

    key = 'YOUR_SHEET_KEY'
    sheet_name = 'YOUR_SHEET_NAME'
    csv_url = f'https://docs.google.com/spreadsheets/d/{key}/gviz/tq?tqx=out:csv&sheet={sheet_name}'

    pd.read_csv(csv_url)

  4. Run the cell to import your data into a Count dataframe.

Did this answer your question?