Beta
Table of Contents
The outline of your notebook will show up here. You can include headings in any text cell by starting a line with #
, ##
, ###
, etc., depending on the desired title hierarchy.
!pip install -q gspread
import gspread
import pandas as pd
from google.oauth2.credentials import Credentials
# Authenticate with Google Sheets API using service account credentials
creds = Credentials.from_authorized_user_file('token.json')
client = gspread.authorize(creds)
# Open the sheet and read the data
sheet = client.open('Chocolate Database').worksheet("Main Data")
data = sheet.get_all_records()
# Convert data to Pandas dataframe
df = pd.DataFrame(data, columns=data[0]).iloc[:, :-1]
# Print the dataframe
df.head(10)