Skip to content

Instantly share code, notes, and snippets.

@chiboyap
Forked from lakshay-arora/add_sheet.py
Created October 20, 2021 00:26
Show Gist options
  • Select an option

  • Save chiboyap/eda09b00d0cb93aab458494f6effd6e6 to your computer and use it in GitHub Desktop.

Select an option

Save chiboyap/eda09b00d0cb93aab458494f6effd6e6 to your computer and use it in GitHub Desktop.
# get the total number of columns
sheet_instance.col_count
## >> 26
# get the value at the specific cell
sheet_instance.cell(col=3,row=2)
## >> <Cell R2C3 '63881'>
# get the instance of the Spreadsheetsheet_instance = sheet.get_worksheet(0)
sheet = client.open('commentary data')
# get all the records of the data
records_data = sheet_instance.get_all_records()
# view the data
records_data
sheet_instance = sheet.get_worksheet(0)
# importing the required libraries
import gspread
import pandas as pd
from oauth2client.service_account import ServiceAccountCredentials
# define the scope
scope = ['https://spreadsheets.google.com/feeds','https://www.googleapis.com/auth/drive']
# add credentials to the account
creds = ServiceAccountCredentials.from_json_keyfile_name('My Sample Project-61da96a5184b.json', scope)
# authorize the clientsheet = client.open('commentary data')
client = gspread.authorize(creds)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment