Back to Templates

Collect API User Data and Store in Google Sheets with CSV Backup

Created by

Created by: PrideVel || pridevel

PrideVel

Last update

Last update a day ago

Categories

Share


🧠 Overview

This workflow automatically fetches user data from an API, formats it, and stores it in Google Sheets and CSV files.

💡 Use Cases

  • Collect user records for analytics or reporting
  • Maintain centralized spreadsheets for marketing or CRM
  • Export CSV backups for offline analysis or integrations

📘 Good to Know

  • Uses the BASE_URL environment variable for the API endpoint
  • Google Sheets integration requires OAuth2 credentials
  • CSV export saves a local copy for backup or external use
  • Optional error handler ensures the workflow stops safely if any step fails

⚙️ How It Works

  1. Manual Trigger – Start the workflow manually or via schedule

  2. HTTP Request – Fetch data from the API endpoint

  3. Set Node – Extract and format fields like name (first + last) and country

  4. Google Sheets – Append processed data to a Google Sheet

    • Sheet ID: qwertz
    • Range: A:C
  5. Spreadsheet File – Export data to CSV (users_spreadsheet.csv)

  6. Error Handler – Stops workflow if any step fails


🚀 How to Use

  • Trigger the workflow manually or schedule it
  • Ensure environment variables and credentials are configured
  • Check the Google Sheet for appended user data
  • Access the CSV file for backups or external use

🧩 Requirements

  • API endpoint (BASE_URL)
  • Google Sheets OAuth2 credentials
  • Permission to write files for CSV export

⚙️ Setup Instructions

  1. Set Environment Variables:

    • Add BASE_URL in workflow environment variables.
  2. Configure Google Sheets Node:

    • Authenticate with your Google account using OAuth2.
    • Specify the target Sheet ID and range.
  3. Check File Permissions:

    • Ensure the workflow has write access to store users_spreadsheet.csv.
  4. Test the API Response Format:

    • Expected JSON fields: first_name, last_name, country, etc.
    • Adjust the Set Node to map any additional fields as required.

🛠️ Customizing the Workflow

  • Change API Source: Update the HTTP Request node to any user data API.
  • Add More Fields: Modify the Set node to map additional fields from the API response.
  • Multi-Sheet Distribution: Append data to multiple Google Sheets if needed.
  • Automated Scheduling: Trigger workflow automatically at intervals.
  • Add Notifications: Send email or Slack notifications after data collection.