n8n

How to Automate Gmail to Google Sheets Data Import?

Gather fresh user records, save them in files, share by email, and log them into a spreadsheet with one run. Ideal for operations teams that need quick test data, contact lists, or simple data pipelines without coding.

The flow pulls sample users from an API, maps clean fields like full name and country, and writes rows to Google Sheets. It also creates a CSV file, turns that CSV back into JSON, saves the JSON to disk, and emails it as an attachment with Gmail. The email attachment is then read back into the workflow and added to Google Sheets again. Key parts include HTTP Request, Set for field mapping, Google Sheets append, two Spreadsheet File steps for format changes, Move Binary Data for file handling, Write Binary File for storage, and Gmail to send the file.

Plan on using Google accounts for Sheets and Gmail plus OAuth in n8n. Replace the sample sheet settings with your own sheet and range. Expect faster list building and fewer copy paste errors. Good fits include seeding demo data, sharing lists with teammates, or testing file based import steps. Run it as needed from n8n and verify rows appear in your sheet and the email arrives with the JSON file.

What are the key features?

  • Fetch sample user data using HTTP Request from a public API.
  • Map clean fields like full name and country with the Set node.
  • Append rows to Google Sheets with OAuth2 and a defined range A to C.
  • Convert JSON records to a CSV file using Spreadsheet File.
  • Turn the CSV back into JSON for reuse and downstream steps.
  • Write a JSON file to disk for storage or audits.
  • Send the JSON file as an email attachment with Gmail.
  • Read the email attachment back into the flow with Move Binary Data.
  • Append the parsed file contents into Google Sheets again for tracking.

What are the benefits?

  • Reduce manual list building from 60 minutes to 5 minutes
  • Automate 90% of copy paste work between email and sheets
  • Improve data accuracy by 95% by removing retyping
  • Connect Gmail and Google Sheets in one simple flow
  • Handle hundreds of rows per run without extra effort

How do you set it up?

  1. Import the template into n8n: Create a new workflow in n8n > Click the three dots menu > Select 'Import from File' > Choose the downloaded JSON file.
  2. You’ll need accounts with Google Sheets and Gmail. See the Tools Required section above for links to create accounts with these services.
  3. In n8n, open the Google Sheets node, click Credential to connect with, select Create new credential, and follow the on screen steps to sign in with Google and approve access.
  4. Open the Gmail node, click Credential to connect with, select Create new credential, and complete the Google sign in and permission prompts.
  5. In the Google Sheets nodes, replace the sample sheet reference with your own spreadsheet. Pick the target sheet and confirm the range A:C. Keep Use path for key row enabled if your header row should be set from mapped fields.
  6. Open the HTTP Request node and run it once to confirm you receive user data. Check the Execution data to see result fields like name and location.
  7. In the Set node, confirm the field mappings for name and country. Adjust or add fields to match your sheet headers.
  8. In the first Spreadsheet File node, set operation to To file and file format to CSV. This creates a CSV from the mapped JSON rows.
  9. In the second Spreadsheet File node, set it to parse the CSV back into JSON. Keep the default delimiter unless your data requires a different one.
  10. In Write Binary File, keep the default file name or change it to a path that your n8n setup can write to. The default works in most cases.
  11. In the Gmail node, set the To address, subject, and message. Under attachments, ensure the binary property matches the Move Binary Data output property name.
  12. In Move Binary Data after Gmail, set source key to attachment_0 and mode to convert the attachment into JSON so it can be appended to the sheet.
  13. Run the workflow. Verify a new row appears in Google Sheets, the email arrives with the JSON file, and that the second Google Sheets node appends data from the email attachment.
  14. If a Google Sheets step fails, check the sheet ID, selected tab, and range. If the email has no attachment, confirm the binary property name matches and that the Move Binary Data nodes point to the correct keys.

Tools Required

$24 / mo or $20 / mo billed annually to use n8n in the cloud. However, the local or self-hosted n8n Community Edition is free.

Gmail

Sign up

No cost: Personal Gmail (Gmail API has no usage-based pricing; quotas apply)

Google Sheets

Sign up

Free: $0 (Google Sheets API usage has no additional cost; quota limits apply)

Similar Templates

Join Futurise to access 1,200+ automation templates

Get instant access to ready-made automation workflows for n8n, Make.com, AI agents, and more. Download, customise, and deploy in minutes.