I created a sample notebook for fetching Google Spreadsheet data from Google Colab.

You can try it from the following link.

https://colab.research.google.com/github/nakamura196/ndl_ocr/blob/main/Google_ColabからGoogle_Spreadsheetのデータを取得するサンプル.ipynb

As shown below, you can retrieve the contents of a Google Spreadsheet.

Below is the source code.


from google.colab import auth
auth.authenticate_user()

import gspread
from google.auth import default
creds, _ = default()

gc = gspread.authorize(creds)

import pandas as pd
from pandas import json_normalize

# Specify the sheet
ss_id = "<Google Spreadsheet ID>"
workbook = gc.open_by_key(ss_id)

worksheet = workbook.get_worksheet(0)

# Fetch all data
data = worksheet.get_all_records()

df = json_normalize(data)
df

I hope this serves as a useful reference.