How to use Google Sheets as a database
Dive into the versatility of Google Sheets as a database with our in-depth comparison of Python scripting and n8n automation. Get 7 free workflows to set up your Google Sheets database in n8n!
Save yourself the work of writing custom integrations for Gmail and Google Sheets and use n8n instead. Build adaptable and scalable Communication, HITL, Data & Storage, and Productivity workflows that work with your technology stack. All within a building experience you will love.
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.
You can find Gmail and Google Sheets 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 Gmail and Google Sheets nodes one by one: input data on the left, parameters in the middle, and output data on the right.
A connection establishes a link between Gmail and Google Sheets (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.
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 Gmail and Google Sheets with any of n8n’s 1000+ integrations, and incorporate advanced AI logic into your workflows.
Save and run the workflow to see if everything works as expected. Based on your configuration, data should flow from Gmail to Google Sheets 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.
How it works
This workflow automates the process of creating, approving, and optionally posting LinkedIn content from a Google Sheet. Here's a high-level overview:
Scheduled Trigger: Runs automatically based on your defined time interval (daily, weekly, etc.).
Fetch Data from Google Sheets: Pulls the first row from your sheet where Status is marked as Pending.
Generate LinkedIn Post Content: Uses OpenAI to create a professional LinkedIn post using the Post Description and Instructions from the sheet.
Format & Prepare Data: Formats the generated content along with the original instruction and post description for email.
Send for Approval: Sends an email to a predefined user (e.g., marketing team) with a custom form for approval, including a dropdown to accept/reject and an optional field for edits.
(Optional) Image Fetch: Downloads an image from a URL (if provided in the sheet) for future use in post visuals.
Set up steps
You’ll need the following before you start:
A Google Sheet with the following columns: Post Description, Instructions, Image (URL), Status
Access to an OpenAI API key
A connected Gmail account for sending approval emails
Your own Google Sheets and Gmail credentials added in n8n
Steps:
Google Sheet Preparation:
Create a new Google Sheet with the mentioned columns (Post Description, Instructions, Image, Status, Output, Post Link).
Add a row with test data and set Status to Pending.
Credentials:
In n8n, create OAuth2 credentials for:
a. Google Sheets
b. Gmail
c. OpenAI (API Key)
Assign these credentials to the respective nodes in the JSON.
OpenAI Model:
Choose a model like gpt-4o-mini (used here) or any other available in your plan.
Adjust the prompt in the "Generate Post Content" node if needed.
Email Configuration:
In the Gmail node, set the recipient email to your own or your team’s address.
Customize the email message template if necessary.
Schedule the Workflow:
Set the trigger interval (e.g., every morning at 9 AM).
Testing:
Run the workflow manually first to confirm everything works.
Check Gmail for the approval form, respond, and verify the results.
Nodes used in this workflow
Create custom Gmail and Google Sheets 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.

Dive into the versatility of Google Sheets as a database with our in-depth comparison of Python scripting and n8n automation. Get 7 free workflows to set up your Google Sheets database in n8n!

Explore 3 efficient methods for importing CSV files into Google Sheets, comparing n8n's automated workflow with the manual import via native Google Sheets interface and the programmatic import via Python.

Learn three different ways to import XML to Google sheets: with Google sheet’s IMPORTXML function, with Google AppScript and automation with n8n.

Learn how to pull data from Google Spreadsheet to HTML using Google Apps Script and n8n automation tool.

Discover two ways to connect MySQL with Google Sheets, and learn to build no-code workflows for automating it.

Discover three ways to import JSON data into Google Sheets or a CSV file, and five no-code workflows for automatically moving data between JSON and spreadsheets.
Yes, Gmail can connect with Google Sheets using n8n.io. With n8n, you can create workflows that automate tasks and transfer data between Gmail and Google Sheets. Configure nodes for Gmail and Google Sheets in the n8n interface, specifying actions and triggers to set up their connection.
Yes, with n8n, you can programmatically interact with Gmail’s API via pre-defined supported actions or raw HTTP requests. With the HTTP Request node, you create a REST API call. You need to understand basic API terminology and concepts.
Yes, with n8n, you can programmatically interact with Google Sheets’s API via pre-defined supported actions or raw HTTP requests. With the HTTP Request node, you create a REST API call. You need to understand basic API terminology and concepts.
Yes, it is safe to use n8n to integrate Gmail and Google Sheets. n8n offers various features to ensure the safe handling of your data. These include encrypted data transfers, secure credential storage, RBAC functionality, and compliance with industry-standard security practices (SOC2 compliant). For hosted plans, data is stored within the EU on servers located in Frankfurt, Germany. You can also host it on your own infrastructure for added control.
Learn more about n8n’s security practices here.
To start integrating Gmail and Google Sheets in n8n, you have different options depending on how you intend to use it:
Unlike other platforms that charge per operation, step, or task, n8n charges only for full workflow executions. This approach guarantees predictable costs and scalability, no matter the complexity or volume of your workflows.





Looking to integrate Gmail and Google Sheets in your company?
Build complex workflows, really fast
Handle branching, merging and iteration easily.
Pause your workflow to wait for external events.
Your data is displayed alongside your settings, making edge cases easy to track down.
Use 1000+ workflow templates available from our core team and our community.
Copy and paste, easily import and export workflows.
Report a vulnerability
© 2024 n8n | All rights reserved.

