Back to Integrations
integrationGoogle Drive node
integrationSalesforce node

Google Drive and Salesforce integration

Save yourself the work of writing custom integrations for Google Drive and Salesforce and use n8n instead. Build adaptable and scalable Data & Storage, Sales, and Communication workflows that work with your technology stack. All within a building experience you will love.

How to connect Google Drive and Salesforce

  • Step 1: Create a new workflow
  • Step 2: Add and configure nodes
  • Step 3: Connect
  • Step 4: Customize and extend your integration
  • Step 5: Test and activate your workflow

Step 1: Create a new workflow and add the first step

In n8n, click the "Add workflow" button in the Workflows tab to create a new workflow. Add the starting point – a trigger on when your workflow should run: an app event, a schedule, a webhook call, another workflow, an AI chat, or a manual trigger. Sometimes, the HTTP Request node might already serve as your starting point.

Google Drive and Salesforce integration: Create a new workflow and add the first step

Step 2: Add and configure Google Drive and Salesforce nodes

You can find Google Drive and Salesforce in the nodes panel. Drag them onto your workflow canvas, selecting their actions. Click each node, choose a credential, and authenticate to grant n8n access. Configure Google Drive and Salesforce nodes one by one: input data on the left, parameters in the middle, and output data on the right.

Google Drive and Salesforce integration: Add and configure Google Drive and Salesforce nodes

Step 3: Connect Google Drive and Salesforce

A connection establishes a link between Google Drive and Salesforce (or vice versa) to route data through the workflow. Data flows from the output of one node to the input of another. You can have single or multiple connections for each node.

Google Drive and Salesforce integration: Connect Google Drive and Salesforce

Step 4: Customize and extend your Google Drive and Salesforce integration

Use n8n's core nodes such as If, Split Out, Merge, and others to transform and manipulate data. Write custom JavaScript or Python in the Code node and run it as a step in your workflow. Connect Google Drive and Salesforce with any of n8n’s 1000+ integrations, and incorporate advanced AI logic into your workflows.

Google Drive and Salesforce integration: Customize and extend your Google Drive and Salesforce integration

Step 5: Test and activate your Google Drive and Salesforce workflow

Save and run the workflow to see if everything works as expected. Based on your configuration, data should flow from Google Drive to Salesforce or vice versa. Easily debug your workflow: you can check past executions to isolate and fix the mistake. Once you've tested everything, make sure to save your workflow and activate it.

Google Drive and Salesforce integration: Test and activate your Google Drive and Salesforce workflow

Automate invoice processing with OCR, GPT-4 & Salesforce opportunity creation

PDF Invoice Extractor (AI)

End-to-end pipeline: Watch Drive ➜ Download PDF ➜ OCR text ➜ AI normalize to JSON ➜ Upsert Buyer (Account) ➜ Create Opportunity ➜ Map Products ➜ Create OLI via Composite API ➜ Archive to OneDrive.

Node by node (what it does & key setup)

  1. Google Drive Trigger
    Purpose**: Fire when a new file appears in a specific Google Drive folder.
    Key settings**:
    Event: fileCreated
    Folder ID: google drive folder id
    Polling: everyMinute
    Creds: googleDriveOAuth2Api
    Output**: Metadata { id, name, ... } for the new file.

  2. Download File From Google
    Purpose**: Get the file binary for processing and archiving.
    Key settings**:
    Operation: download
    File ID: ={{ $json.id }}
    Creds: googleDriveOAuth2Api
    Output**: Binary (default key: data) and original metadata.

  3. Extract from File
    Purpose**: Extract text from PDF (OCR as needed) for AI parsing.
    Key settings**:
    Operation: pdf
    OCR: enable for scanned PDFs (in options)
    Output**: JSON with OCR text at {{ $json.text }}.

  4. Message a model (AI JSON Extractor)
    Purpose: Convert OCR text into strict normalized JSON array (invoice schema).
    Key settings
    :
    Node: @n8n/n8n-nodes-langchain.openAi
    Model: gpt-4.1 (or gpt-4.1-mini)
    Message role: system (the strict prompt; references {{ $json.text }})
    jsonOutput: true
    Creds: openAiApi
    Output (per item): $.message.content → the parsed **JSON (ensure it’s an array).

  5. Create or update an account (Salesforce)
    Purpose: Upsert Buyer as Account using an external ID.
    Key settings
    :
    Resource: account
    Operation: upsert
    External Id Field: tax_id__c
    External Id Value: ={{ $json.message.content.buyer.tax_id }}
    Name: ={{ $json.message.content.buyer.name }}
    Creds: salesforceOAuth2Api
    Output: Account record (captures Id) for downstream **Opportunity.

  6. Create an opportunity (Salesforce)
    Purpose**: Create Opportunity linked to the Buyer (Account).
    Key settings**:
    Resource: opportunity
    Name: ={{ $('Message a model').item.json.message.content.invoice.code }}
    Close Date: ={{ $('Message a model').item.json.message.content.invoice.issue_date }}
    Stage: Closed Won
    Amount: ={{ $('Message a model').item.json.message.content.summary.grand_total }}
    AccountId: ={{ $json.id }} (from Upsert Account output)
    Creds: salesforceOAuth2Api
    Output**: Opportunity Id for OLI creation.

  7. Build SOQL (Code / JS)
    Purpose: Collect unique product codes from AI JSON and build a SOQL query for PricebookEntry by Pricebook2Id.
    Key settings
    :
    pricebook2Id (hardcoded in script): e.g., 01sxxxxxxxxxxxxxxx
    Source lines: $('Message a model').first().json.message.content.products
    Output**: { soql, codes }

  8. Query PricebookEntries (Salesforce)
    Purpose**: Fetch PricebookEntry.Id for each Product2.ProductCode.
    Key settings**:
    Resource: search
    Query: ={{ $json.soql }}
    Creds: salesforceOAuth2Api
    Output**: Items with Id, Product2.ProductCode (used for mapping).

  9. Code in JavaScript (Build OLI payloads)
    Purpose: Join lines with PBE results and Opportunity Id ➜ build OpportunityLineItem payloads.
    Inputs
    :
    OpportunityId: ={{ $('Create an opportunity').first().json.id }}
    Lines: ={{ $('Message a model').first().json.message.content.products }}
    PBE rows: from previous node items
    Output**: { body: { allOrNone:false, records:[{ OpportunityLineItem... }] } }
    Notes**:
    Converts discount_total ➜ per-unit if needed (currently commented for standard pricing).
    Throws on missing PBE mapping or empty lines.

  10. Create Opportunity Line Items (HTTP Request)
    Purpose**: Bulk create OLIs via Salesforce Composite API.
    Key settings**:
    Method: POST
    URL: https://<your-instance>.my.salesforce.com/services/data/v65.0/composite/sobjects
    Auth: salesforceOAuth2Api (predefined credential)
    Body (JSON): ={{ $json.body }}
    Output**: Composite API results (per-record statuses).

  11. Update File to One Drive
    Purpose: Archive the original PDF in OneDrive.
    Key settings
    :
    Operation: upload
    File Name: ={{ $json.name }}
    Parent Folder ID: onedrive folder id
    Binary Data: true (from the Download node)
    Creds: microsoftOneDriveOAuth2Api
    Output**: Uploaded file metadata.

Data flow (wiring)

Google Drive Trigger → Download File From Google
Download File From Google
→ Extract from File
→ Update File to One Drive
Extract from File → Message a model
Message a model
→ Create or update an account
Create or update an account → Create an opportunity
Create an opportunity → Build SOQL
Build SOQL → Query PricebookEntries
Query PricebookEntries → Code in JavaScript
Code in JavaScript → Create Opportunity Line Items

Quick setup checklist

🔐 Credentials: Connect Google Drive, OneDrive, Salesforce, OpenAI.
📂 IDs:
Drive Folder ID (watch)
OneDrive Parent Folder ID (archive)
Salesforce Pricebook2Id (in the JS SOQL builder)
🧠 AI Prompt: Use the strict system prompt; jsonOutput = true.
🧾 Field mappings:
Buyer tax id/name → Account upsert fields
Invoice code/date/amount → Opportunity fields
Product name must equal your Product2.ProductCode in SF.
✅ Test: Drop a sample PDF → verify:
AI returns array JSON only
Account/Opportunity created
OLI records created
PDF archived to OneDrive

Notes & best practices

If PDFs are scans, enable OCR in Extract from File.
If AI returns non-JSON, keep “Return only a JSON array” as the last line of the prompt and keep jsonOutput enabled.
Consider adding validation on parsing.warnings to gate Salesforce writes.
For discounts/taxes in OLI:
Standard OLI fields don’t support per-line discount amounts directly; model them in UnitPrice or custom fields.
Replace the Composite API URL with your org’s domain or use the Salesforce node’s Bulk Upsert for simplicity.

Nodes used in this workflow

Popular Google Drive and Salesforce workflows

Automate Invoice Processing with OCR, GPT-4 & Salesforce Opportunity Creation

PDF Invoice Extractor (AI) End-to-end pipeline: Watch Drive ➜ Download PDF ➜ OCR text ➜ AI normalize to JSON ➜ Upsert Buyer (Account) ➜ Create Opportunity ➜ Map Products ➜ Create OLI via Composite API ➜ Archive to OneDrive. Node by node (what it does & key setup) 1) Google Drive Trigger Purpose**: Fire when a new file appears in a specific Google Drive folder. Key settings**: Event: fileCreated Folder ID: google drive folder id Polling: everyMinute Creds: googleDriveOAuth2Api Output**: Metadata { id, name, ... } for the new file. 2) Download File From Google Purpose**: Get the file binary for processing and archiving. Key settings**: Operation: download File ID: ={{ $json.id }} Creds: googleDriveOAuth2Api Output**: Binary (default key: data) and original metadata. 3) Extract from File Purpose**: Extract text from PDF (OCR as needed) for AI parsing. Key settings**: Operation: pdf OCR: enable for scanned PDFs (in options) Output**: JSON with OCR text at {{ $json.text }}. 4) Message a model (AI JSON Extractor) Purpose: Convert OCR text into **strict normalized JSON array (invoice schema). Key settings**: Node: @n8n/n8n-nodes-langchain.openAi Model: gpt-4.1 (or gpt-4.1-mini) Message role: system (the strict prompt; references {{ $json.text }}) jsonOutput: true Creds: openAiApi Output (per item): $.message.content → the parsed **JSON (ensure it’s an array). 5) Create or update an account (Salesforce) Purpose: Upsert **Buyer as Account using an external ID. Key settings**: Resource: account Operation: upsert External Id Field: tax_id__c External Id Value: ={{ $json.message.content.buyer.tax_id }} Name: ={{ $json.message.content.buyer.name }} Creds: salesforceOAuth2Api Output: Account record (captures Id) for downstream **Opportunity. 6) Create an opportunity (Salesforce) Purpose**: Create Opportunity linked to the Buyer (Account). Key settings**: Resource: opportunity Name: ={{ $('Message a model').item.json.message.content.invoice.code }} Close Date: ={{ $('Message a model').item.json.message.content.invoice.issue_date }} Stage: Closed Won Amount: ={{ $('Message a model').item.json.message.content.summary.grand_total }} AccountId: ={{ $json.id }} (from Upsert Account output) Creds: salesforceOAuth2Api Output**: Opportunity Id for OLI creation. 7) Build SOQL (Code / JS) Purpose: Collect unique product **codes from AI JSON and build a SOQL query for PricebookEntry by Pricebook2Id. Key settings**: pricebook2Id (hardcoded in script): e.g., 01sxxxxxxxxxxxxxxx Source lines: $('Message a model').first().json.message.content.products Output**: { soql, codes } 8) Query PricebookEntries (Salesforce) Purpose**: Fetch PricebookEntry.Id for each Product2.ProductCode. Key settings**: Resource: search Query: ={{ $json.soql }} Creds: salesforceOAuth2Api Output**: Items with Id, Product2.ProductCode (used for mapping). 9) Code in JavaScript (Build OLI payloads) Purpose: Join lines with PBE results and Opportunity Id ➜ build **OpportunityLineItem payloads. Inputs**: OpportunityId: ={{ $('Create an opportunity').first().json.id }} Lines: ={{ $('Message a model').first().json.message.content.products }} PBE rows: from previous node items Output**: { body: { allOrNone:false, records:[{ OpportunityLineItem... }] } } Notes**: Converts discount_total ➜ per-unit if needed (currently commented for standard pricing). Throws on missing PBE mapping or empty lines. 10) Create Opportunity Line Items (HTTP Request) Purpose**: Bulk create OLIs via Salesforce Composite API. Key settings**: Method: POST URL: https://<your-instance>.my.salesforce.com/services/data/v65.0/composite/sobjects Auth: salesforceOAuth2Api (predefined credential) Body (JSON): ={{ $json.body }} Output**: Composite API results (per-record statuses). 11) Update File to One Drive Purpose: Archive the **original PDF in OneDrive. Key settings**: Operation: upload File Name: ={{ $json.name }} Parent Folder ID: onedrive folder id Binary Data: true (from the Download node) Creds: microsoftOneDriveOAuth2Api Output**: Uploaded file metadata. Data flow (wiring) Google Drive Trigger → Download File From Google Download File From Google → Extract from File → Update File to One Drive Extract from File → Message a model Message a model → Create or update an account Create or update an account → Create an opportunity Create an opportunity → Build SOQL Build SOQL → Query PricebookEntries Query PricebookEntries → Code in JavaScript Code in JavaScript → Create Opportunity Line Items Quick setup checklist 🔐 Credentials: Connect Google Drive, OneDrive, Salesforce, OpenAI. 📂 IDs: Drive Folder ID (watch) OneDrive Parent Folder ID (archive) Salesforce Pricebook2Id (in the JS SOQL builder) 🧠 AI Prompt: Use the strict system prompt; jsonOutput = true. 🧾 Field mappings: Buyer tax id/name → Account upsert fields Invoice code/date/amount → Opportunity fields Product name must equal your Product2.ProductCode in SF. ✅ Test: Drop a sample PDF → verify: AI returns array JSON only Account/Opportunity created OLI records created PDF archived to OneDrive Notes & best practices If PDFs are scans, enable OCR in Extract from File. If AI returns non-JSON, keep “Return only a JSON array” as the last line of the prompt and keep jsonOutput enabled. Consider adding validation on parsing.warnings to gate Salesforce writes. For discounts/taxes in OLI: Standard OLI fields don’t support per-line discount amounts directly; model them in UnitPrice or custom fields. Replace the Composite API URL with your org’s domain or use the Salesforce node’s Bulk Upsert for simplicity.

Build your own Google Drive and Salesforce integration

Create custom Google Drive and Salesforce workflows by choosing triggers and actions. Nodes come with global operations and settings, as well as app-specific parameters that can be configured. You can also use the HTTP Request node to query data from any app or service with a REST API.

Google Drive supported actions

Copy
Create a copy of an existing file
Create From Text
Create a file from a provided text
Delete
Permanently delete a file
Download
Download a file
Move
Move a file to another folder
Share
Add sharing permissions to a file
Update
Update a file
Upload
Upload an existing file to Google Drive
Search
Search or list files and folders
Create
Create a folder
Delete
Permanently delete a folder
Share
Add sharing permissions to a folder
Create
Create a shared drive
Delete
Permanently delete a shared drive
Get
Get a shared drive
Get Many
Get the list of shared drives
Update
Update a shared drive

Salesforce supported actions

Add Note
Add note to an account
Create
Create an account
Create or Update
Create a new account, or update the current one if it already exists (upsert)
Delete
Delete an account
Get
Get an account
Get Many
Get many accounts
Get Summary
Returns an overview of account's metadata
Update
Update an account
Create
Create a attachment
Delete
Delete a attachment
Get
Get a attachment
Get Many
Get many attachments
Get Summary
Returns an overview of attachment's metadata
Update
Update a attachment
Add Comment
Add a comment to a case
Create
Create a case
Delete
Delete a case
Get
Get a case
Get Many
Get many cases
Get Summary
Returns an overview of case's metadata
Update
Update a case
Add Contact To Campaign
Add contact to a campaign
Add Note
Add note to a contact
Create
Create a contact
Create or Update
Create a new contact, or update the current one if it already exists (upsert)
Delete
Delete a contact
Get
Get a contact
Get Many
Get many contacts
Get Summary
Returns an overview of contact's metadata
Update
Update a contact
Create
Create a custom object record
Create or Update
Create a new record, or update the current one if it already exists (upsert)
Delete
Delete a custom object record
Get
Get a custom object record
Get Many
Get many custom object records
Update
Update a custom object record
Upload
Upload a document
Get Many
Get many flows
Invoke
Invoke a flow
Add Lead To Campaign
Add lead to a campaign
Add Note
Add note to a lead
Create
Create a lead
Create or Update
Create a new lead, or update the current one if it already exists (upsert)
Delete
Delete a lead
Get
Get a lead
Get Many
Get many leads
Get Summary
Returns an overview of Lead's metadata
Update
Update a lead
Add Note
Add note to an opportunity
Create
Create an opportunity
Create or Update
Create a new opportunity, or update the current one if it already exists (upsert)
Delete
Delete an opportunity
Get
Get an opportunity
Get Many
Get many opportunities
Get Summary
Returns an overview of opportunity's metadata
Update
Update an opportunity
Query
Execute a SOQL query that returns all the results in a single response
Create
Create a task
Delete
Delete a task
Get
Get a task
Get Many
Get many tasks
Get Summary
Returns an overview of task's metadata
Update
Update a task
Get
Get a user
Get Many
Get many users

FAQs

  • Can Google Drive connect with Salesforce?

  • Can I use Google Drive’s API with n8n?

  • Can I use Salesforce’s API with n8n?

  • Is n8n secure for integrating Google Drive and Salesforce?

  • How to get started with Google Drive and Salesforce integration in n8n.io?

Need help setting up your Google Drive and Salesforce integration?

Discover our latest community's recommendations and join the discussions about Google Drive and Salesforce integration.
hubschrauber
Jon
David O'Neil

Looking to integrate Google Drive and Salesforce in your company?

Over 3000 companies switch to n8n every single week

Why use n8n to integrate Google Drive with Salesforce

Build complex workflows, really fast

Build complex workflows, really fast

Handle branching, merging and iteration easily.
Pause your workflow to wait for external events.

Code when you need it, UI when you don't

Simple debugging

Your data is displayed alongside your settings, making edge cases easy to track down.

Use templates to get started fast

Use 1000+ workflow templates available from our core team and our community.

Reuse your work

Copy and paste, easily import and export workflows.

Implement complex processes faster with n8n

red iconyellow iconred iconyellow icon