Created
February 11, 2021 08:28
-
-
Save ivansaul/28257e793ae9b8575bb5c0f1b3906dad to your computer and use it in GitHub Desktop.
Simplest Way of Reading Google Sheets into a Pandas Dataframe (Python)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
#Create a public URL | |
#https://docs.google.com/spreadsheets/d/0Ak1ecr7i0wotdGJmTURJRnZLYlV3M2daNTRubTdwTXc/edit?usp=sharing | |
#get spreadsheets key from url | |
gsheetkey = "0Ak1ecr7i0wotdGJmTURJRnZLYlV3M2daNTRubTdwTXc" | |
#sheet name | |
sheet_name = 'Sheet 1' | |
url=f'https://docs.google.com/spreadsheet/ccc?key={gsheetkey}&output=xlsx' | |
df = pd.read_excel(url,sheet_name=sheet_name) | |
print(df) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This code works and it helped me. Thank you!