This n8n workflow automates the process of fetching user data from an API, verifying its validity, transforming the response, and then saving it to Google Sheets for team collaboration. Additionally, it generates a CSV backup file of the same data for offline access or external integrations.
Perfect for developers, analysts, or teams who want an automated, no-code data ingestion and backup solution.
Manual Trigger Node)The workflow starts manually by clicking Execute Workflow. You can later replace this with a Cron or Webhook trigger for automation.
HTTP Request Node)Makes an HTTP GET request to the configured API endpoint defined in the environment variable BASE_URL.
Example:
https://randomuser.me/api/?results=10
This node fetches raw user data in JSON format.
If Node)Checks if the API response returned an HTTP 200 status code.
This prevents saving invalid or failed responses.
Function Node)Formats the raw JSON data to extract key details (name and country) from each user record.
Input Example:
{
"results": [
{
"name": { "first": "John", "last": "Doe" },
"location": { "country": "United States" }
}
]
}
Output Example:
[
{ "name": "John Doe", "country": "United States" }
]
This step makes the data compatible with Google Sheets.
Google Sheets Node)Appends the formatted data to your specified Google Sheet.
Environment Variables Required:
GOOGLE_SHEET_ID → ID of your target Google SheetConfiguration:
A:BName (A) and Country (B)Example Google Sheet:
| Name | Country |
|---|---|
| John Doe | United States |
| Jane Smith | Canada |
Spreadsheet File Node)Generates a .csv file named users_backup_export.csv containing all saved user data.
This file can be:
If the API response is invalid (non-200), the Stop on API Failure node halts the workflow and logs the error:
❌ API request failed — status code not 200. Workflow stopped.
This ensures only valid data is stored.
Add Environment Variables:
BASE_URL=https://randomuser.me/api/?results=10
GOOGLE_SHEET_ID=<your_google_sheet_id>
Add Credentials:
Run Workflow:
Check Output:
| Goal | How to Modify |
|---|---|
| Change API fields | Edit Transform API Data function to extract desired fields |
| Add columns | Expand output object and update Google Sheets range (e.g., A:D) |
| Automate execution | Replace manual trigger with a Cron or Webhook node |
| Filter users | Add an If node after transformation to include/exclude data |
| Send email notification | Add Gmail or SMTP node after CSV creation |
✨ Tip: Add a Slack or Telegram node at the end to notify your team whenever new data is added successfully!