Send contacts to gsheet
Tags: #hubspot #crm #sales #contact #naas_drivers #gsheet #snippet #googlesheets
Last update: 2023-04-12 (Created: 2022-02-21)
Description: This notebook allows you to send HubSpot contacts to a Google Sheet for easy tracking and organization.
from naas_drivers import hubspot, gsheet
import naas
👉 Starting November 30, 2022, HubSpot API keys no longer enable access to HubSpot APIs, so in Naas version 2.8.3 and above, you need create a private app and use the access token.
Enter Your Access Token
HS_ACCESS_TOKEN = naas.secret.get("HS_ACCESS_TOKEN") or "YOUR_HS_ACCESS_TOKEN"
Enter your Contact properties
List of properties you want to get from contact.
By default, you will get:
- email
- firstname
- lastname
- createdate
- lastmodifieddate
- hs_object_id
properties = []
Pre-requisite: share your Google Sheets with our service account: 🔗 [email protected]
SPREADSHEET_URL = "ENTER_YOUR_SPREADSHEET_URL_HERE"
SHEET_NAME = "ENTER_YOUR_SHEET_NAME_HERE"
df_contacts = hubspot.connect(HS_ACCESS_TOKEN).contacts.get_all(properties_list)
gsheet.connect(SPREADSHEET_URL).send(
sheet_name=SHEET_NAME, data=df_contacts, append=False
)
Last modified 1mo ago