Naas Documentation
Naas.ai
GitHub
Slack Community
What's new?
Searchβ¦
Welcome to Naas
π
Templates
π
Low-code features
π
Low-code drivers
π¬
AI/Machine Learning
Airtable
Awesome-notebooks
Bubble
Canny
CityFalcon
FTP
HTML builder
Google Sheets
Healthchecks
Hubspot
IFTTT
Integromat
Mailbox
Jupyter
LinkedIn
Markdown
Microsoft Teams
MongoDB
NewsAPI
Notion
PDF
Plotly
Slack
Thinkific
Toucan
Qonto
Yahoo
Zapier
π
Community
Essentials
Advanced
Best Practices
FAQ
β‘
Naas manager
π
Security
Powered By
GitBook
Google Sheets
Fetch data from a sheet in google spreadsheet and get a data frame in your notebook.
Google Sheets: Free Online Spreadsheet Editor | Google Workspace
Pre-requisite: share your Google Sheet with our service account
For the driver to fetch the contents of your google sheet, you need to share it with the service account linked with Naas.
[email protected]
Now you can fetch data from the sheet as a pandas data frame.
Get your
spreadsheetId
for your spreadsheet URL like this :
Get
1
import
naas_drivers
2
β
3
spreadsheet_id
=
"idd"
4
sheet_name
=
"sheet_name"
5
β
6
# Dataframe is returned
7
df
=
naas_drivers
.
gsheet
.
connect
(
spreadsheet_id
).
get
(
8
sheet_name
=
sheet_name
9
)
Copied!
Send
Append
Append to the current sheet.
1
import
naas_drivers
2
β
3
spreadsheet_id
=
"idd"
4
sheet_name
=
"sheet_name"
5
β
6
# Data accepts list of dict or dataframe
7
data
=
[{
"name"
:
"Jean"
,
"email"
:
"
[email protected]
"
},
8
{
"name"
:
"Bunny"
,
"email"
:
"
[email protected]
"
}]
9
β
10
naas_drivers
.
gsheet
.
connect
(
spreadsheet_id
).
send
(
11
sheet_name
=
sheet_name
,
12
data
=
data
13
)
Copied!
Erase and replace
When you need to clear the sheet before filling it!
1
import
naas_drivers
2
β
3
spreadsheet_id
=
"idd"
4
sheet_name
=
"sheet_name"
5
β
6
# Data accepts list of dict or dataframe
7
data
=
[{
"name"
:
"Jean"
,
"email"
:
"
[email protected]
"
},
8
{
"name"
:
"Bunny"
,
"email"
:
"
[email protected]
"
}]
9
β
10
naas_drivers
.
gsheet
.
connect
(
spreadsheet_id
).
send
(
11
sheet_name
=
sheet_name
,
12
data
=
data
,
13
append
=
False
14
)
Copied!
Delete
delete rows to the current sheet.
1
import
naas_drivers
2
β
3
spreadsheet_id
=
"idd"
4
sheet_name
=
"sheet_name"
5
β
6
# Data accepts list of dict or dataframe
7
rows
=
[
3
,
4
,
5
]
8
β
9
naas_drivers
.
gsheet
.
connect
(
spreadsheet_id
).
delete
(
10
sheet_name
=
sheet_name
,
11
rows
=
rows
12
)
Copied!
Connect
You can also save your connection and don't repeat it for each method.
1
import
naas_drivers
2
β
3
gsheet
=
naas_drivers
.
gsheet
.
connect
(
"spreadsheet_id"
)
Copied!
Official documentation
GitHub - melalj/gsheet-api: Google Spreadsheet REST API Simplified (full CRUD)
GitHub
Previous
HTML builder
Next
Healthchecks
Copy link
Edit on GitHub
Contents
Pre-requisite: share your Google Sheet with our service account
Get
Send
Append
Erase and replace
Delete
Connect
Official documentation