Created
November 5, 2022 07:58
-
-
Save harshmaur/ea0d932a2b11f3f3219cc1dcb17fe0b1 to your computer and use it in GitHub Desktop.
Download Sheet and Get Records
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
credential_path = "credentials.json" # ensure the path is correct. | |
sheet_url = "https://docs.google.com/spreadsheets/d/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" # replace with the sheet url | |
worksheet_name = "Sheet1" # Name of the worksheet you want to access | |
gc = gspread.service_account(pkg_resources.resource_filename(__name__, credential_path)) | |
sh = gc.open_by_url(sheet_url) | |
worksheet = sh.worksheet(worksheet_name) | |
records = worksheet.get_all_records() | |
df = pd.DataFrame(records) | |
# Now you can use df to do your operations. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment