Template request | Bug report | Generate Data Product
Tags: #mongodb #googlesheets #nosql #operations #automation
Author: Oketunji Oludolapo
This notebook will help you send data from your MongoDB database collection to your spreadsheet
How To Use Template: Video
from naas_drivers import mongo, gsheet
import pandas as pd
import naas
- Get your user, password and connection URL details from your MongoDB Atlas Cluster How To get Required MongoDB details: Article
user = "your user"
passwd = "your password"
host = "Your Connection URL"
port = 9090
collection_name = "COLLECTION NAME"
db_name = "DATABASE NAME"
- Share your Google Sheet with our service account : 🔗 [email protected]
spreadsheet_id = "------"
sheet_name = "Sheet1"
naas.scheduler.add(
cron="0 9 * * *"
) # Send in production this notebook and run it, every day at 9:00.
# use this to delete your automation
# naas.scheduler.delete()
df = mongo.connect(host, port, user, passwd).get(collection_name, db_name)
gsheet.connect(spreadsheet_id).send(sheet_name=sheet_name, data=df, append=False)