Skip to content

Instantly share code, notes, and snippets.

@mebaysan
Created February 8, 2023 14:35
Show Gist options
  • Save mebaysan/b757bfa1e553a235b757b70b3e7bd6ae to your computer and use it in GitHub Desktop.
Save mebaysan/b757bfa1e553a235b757b70b3e7bd6ae to your computer and use it in GitHub Desktop.
# !pip install pandas
import pandas as pd
def read_gsheet(google_sheet_id, work_sheet_name):
# google_sheet_id => You can find the sheet id in the url of your file behind “d/”, copy it from your browser and paste it into your code. The sheet name is the name you gave your sheet.
url = f"https://docs.google.com/spreadsheets/d/{google_sheet_id}/gviz/tq?tqx=out:csv&sheet={work_sheet_name}"
return pd.read_csv(url)
read_gsheet("","")
@mebaysan
Copy link
Author

mebaysan commented Feb 8, 2023

Creating pandas dataframe from google sheets.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment