uv syncipykernel is included in this project dependencies, so after syncing you can register this environment as a notebook kernel on macOS and Windows:
uv run python -m ipykernel install --user --name gsheets2api --display-name "Python (gsheets2api)"- Repo in JupyterLab: Open in Notebook.link (Lab)
This API returns a given Google Sheet's rows as JSON data.
In order to use it:
- The first row of your Google Sheet should be a header row (here's an example).
- Link sharing must be turned on so anyone with the link can view the Google Sheet.
The format for this API is:
https://opensheet.elk.sh/spreadsheet_id/tab_name
For example:
https://opensheet.elk.sh/1o5t26He2DzTweYeleXOGiDjlU4Jkx896f95VUHVgS8U/Test+Sheet
You can also replace tab_name with the tab number (in the order that the tabs are arranged), if you don't know the name. For example, to get the first sheet:
https://opensheet.elk.sh/1o5t26He2DzTweYeleXOGiDjlU4Jkx896f95VUHVgS8U/1
Take note that the first sheet in order is numbered 1, not 0.
Adding the ?raw=true URL parameter returns the raw, unformatted data from the sheet. Without this parameter, Google Sheets formats numbers, dates, and other data types, but with ?raw=true, you'll get the underlying values.