Google Sheets

Fetch data from a sheet in google spreadsheet and get a data frame in your notebook.

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.

Now you can fetch data from the sheet as a pandas data frame.

Get your spreadsheetId for your spreadsheet url like this :

spreadsheetId

Get

import naas_drivers
spreadsheet_id = "idd"
data = naas_drivers.gsheet.connect(spreadsheet_id).get(
sheet_name="name"
)

Send

import naas_drivers
data = [{ "name": "Jean", "email": "[email protected]" }, { "name": "Bunny", "email": "[email protected]" }]
# It accept list of dict or dataframe
spreadsheet_id = "idd"
naas_drivers.gsheet.connect(spreadsheet_id).send(
sheet_name="TSLA",
data=data
)

Connect

You can also save your connection and don't repeat it for each method.

import naas_drivers
gsheet = naas_drivers.gsheet.connect("spreadsheet_id")
name_1 = cityfalcon.get("name_1")
name_2 = cityfalcon.get("name_2")

Official documentation