Automate User Data Capture from API to Google Sheets & CSV with n8n

This workflow automates fetching user data from a public API and storing it in Google Sheets and CSV format, saving time and reducing manual data entry errors. Follow this guide to build an efficient data capture automation using n8n.
httpRequest
set
googleSheets
+2
Workflow Identifier: 2406
NODES in Use: HTTP Request, Set, Google Sheets, Spreadsheet File, Sticky Note
Automate user data with n8n and Google Sheets

Press CTRL+F5 if the workflow didn't load.

Learn how to Build this Workflow with AI:

What This Automation Does

This workflow automatically gets user info from a public API.
It picks just the name and country from the data.
Then it adds that info to a Google Sheets file and saves it as a CSV file locally.
It helps avoid manual copying and saves lots of time.

You will get clean user lists in your Google Sheets and a CSV file every time you run this.
This cuts simple mistakes when moving data by hand.


How This Workflow Works (Input → Process → Output)

Input

  • Random User API: Provides user info in JSON format from https://randomuser.me/api/.

Processing Steps

  • HTTP Request node: Fetches raw user data from the API.
  • Set node: Extracts just first+last name and country from the raw JSON.
  • Google Sheets node: Adds this cleaned data to the Google Sheets spreadsheet as new rows.
  • Spreadsheet File node: Creates a CSV file from the same data for offline use.

Output

  • New rows in Google Sheets containing user names and countries.
  • A CSV file named users_spreadsheet.csv saved locally containing the same data.

Who Should Use This Workflow

Users who want to save time collecting user info from public APIs.
Anyone tired of copying and pasting names and countries by hand.
Ideal for teams sharing user data as sheets or CSV files.


Tools and Services Used

  • Random User API: Supplies random user data in JSON.
  • Google Sheets: Stores user info as a live spreadsheet online.
  • n8n: Orchestrates all the data fetching, setting, appending, and exporting steps.

If self hosting is preferred, use self-host n8n to control the automation environment.


Beginner Step-by-Step: How to Use This Workflow in n8n

Import the Workflow

  1. Click the Download button on this page to get the workflow JSON file.
  2. Open your n8n editor where you want to run this automation.
  3. Use the menu option “Import from File” and pick the downloaded JSON file.

Configure Credentials and IDs

  1. Add Google Sheets OAuth2 credentials inside n8n if not already done.
  2. Enter the Google Sheet ID where data should be appended (found in your Google Sheets URL).
  3. Update the Range to match columns where name and country will go, like A:C.

Test the Workflow

  1. Run the workflow manually once to check it connects to the API and writes to sheets correctly.
  2. Look for any errors. Fix credential or sheet ID if needed.

Activate for Production

  1. When tests pass, turn the workflow ON by toggling the switch in n8n.
  2. Optionally, add a Cron Trigger to schedule automatic runs daily or weekly.

Common Problems and How to Fix Them

Problem: “Unauthorized” or “Permission Denied” in Google Sheets node

Cause: Google Sheets OAuth2 credential expired or was set wrong.

Fix: Re-authenticate Google Sheets credentials in n8n credentials section.

Problem: Empty fields from Set node

Cause: JSON paths are incorrect or data structure changed.

Fix: Check HTTP Request output and adjust JSON path syntax in the Set node expressions.


Customization Ideas

  • Fetch many users at once by changing the URL in the HTTP Request node to https://randomuser.me/api/?results=10 and set the workflow to loop over each user result.
  • Add more user info like email or phone by adding more fields in the Set node with correct JSON paths.
  • Change CSV output formats in the Spreadsheet File node, for example save as Excel instead of CSV.
  • Automate repeating runs by adding a Cron Trigger node to schedule daily or weekly data updates.

Pre-Production Checklist

  • Check that Google Sheets credentials allow appending rows without errors.
  • Test HTTP Request node alone to be sure the API is reachable and sends expected data.
  • Make sure the Set node only produces the desired name and country fields.
  • Verify new rows appear in the right spreadsheet and columns.
  • Confirm the Spreadsheet File node generates a CSV file named as expected.

Summary

→ Automates user info fetch from Random User API.
→ Extracts simple details (name and country).
→ Adds records to Google Sheets spreadsheet.
→ Creates a CSV file for offline use.
✓ Saves time by stopping manual copying.
✓ Keeps data consistent and less error-prone.
✓ Easy to set up and extend for more fields or use cases.


Automate user data with n8n and Google Sheets

Visit through Desktop to Interact with the Workflow.

Frequently Asked Questions

Re-authenticate the Google Sheets OAuth2 credentials in n8n and update the workflow settings.
Incorrect JSON path expressions or changes in the API response structure cause empty fields.
Yes, by adding the results parameter to the API URL and updating the workflow to loop through items.
Yes, add a Cron Trigger node in n8n to run the workflow on a set schedule.

Promoted by BULDRR AI

Related Workflows

Automate Twist Channel Creation and Messaging with n8n

This workflow automates creating and updating a channel in Twist and sending a personalized message to specific users. It eliminates manual setup errors and saves time managing Twist communications.

Automate Ideogram Image Generation with Google Sheets & Gmail

This workflow automates graphic design image generation via Ideogram AI, storing image data in Google Sheets and Google Drive, with email alerts via Gmail. It saves designers hours by automating image creation, remixing, review, and record-keeping.

Automate IT Support with Slack and OpenAI in n8n

Streamline IT support by automating Slack message handling using n8n and OpenAI. This workflow handles Slack DMs, filters bots, queries a Confluence knowledge base, and delivers AI-generated responses, improving support efficiency and response time.

Automate Crypto Analysis with CoinMarketCap & n8n AI Agent

Discover how this unique n8n workflow leverages CoinMarketCap’s multi-agent AI to deliver precise, real-time cryptocurrency insights directly via Telegram. Manage crypto data analysis efficiently with automated multi-source API integration.

Automate Gumroad to Beehiiv Subscriber Sync with n8n

Learn how to automatically add new Gumroad sales customers as Beehiiv newsletter subscribers using n8n automation. This workflow saves time by syncing sales data to Google Sheets CRM and notifying your Telegram channel instantly.

Generate On-Brand Blog Articles Using n8n and OpenAI

This workflow automates the creation of on-brand blog articles by analyzing existing company content using n8n and OpenAI. It extracts article structures and brand voice to produce consistent draft articles, saving significant content creation time.
1:1 Free Strategy Session
Your competitors are already automating. Are you still paying for it manually?

Do you want to adopt AI Automation?

Every hour your team does repetitive work, you're burning real money.
While you wait, faster businesses are cutting costs and moving quicker.
AI and automations aren't the future anymore — they're the present.

Book a live 1-on-1 session where we show you exactly which of your daily tasks can be automated — and what it’s costing you not to.