Dynamic CSV Data Import to HubSpot CRM with Field Mapping - n8n Workflow

Use this robust n8n workflow to import large CSV files into HubSpot (Companies, Contacts, Deals) with automatic property validation and dynamic field correspondence mapping via Google Sheets.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?


  • CRM Administrators needing a reliable method for mass data imports into HubSpot.

  • n8n Automation Specialists looking for advanced examples of dynamic form triggers and custom field validation logic.

  • Technical users who manage HubSpot data synchronization and property definitions.

  • Anyone seeking flexible n8n templates for integrating Google Sheets and HubSpot.

Overview

Managing bulk data imports into a complex CRM like HubSpot often fails due to mismatched field names or missing properties. This powerful n8n workflow solves this by introducing two key automated flows.

The first flow (triggered manually) ensures your Google Sheet holds an up-to-date list of all existing, non-hidden HubSpot properties across objects like Contacts, Companies, and Deals. This acts as a reliable source of truth.

The second flow uses an n8n trigger in the form of a file upload form. After a user uploads a CSV, the n8n workflow instantly checks the CSV headers against the known HubSpot properties. If mismatches occur, the user is presented with a dynamic correspondence form allowing them to map the unknown CSV fields to the correct HubSpot property names, preventing data loss and errors during the final import. This end-to-end automation built in n8n dramatically simplifies large-scale data migrations and updates.

How it Works

This comprehensive n8n workflow operates in two distinct phases:

Phase 1: Property List Update (Setup)


  1. The process begins with a manual n8n trigger ('Start here to update your field list').

  2. The workflow first clears the designated Google Sheet using the Google Sheets n8n node.

  3. An array of HubSpot CRM objects (e.g., 'companies', 'contacts') is defined.

  4. For each object type, an HTTP Request n8n node fetches the currently defined properties from the HubSpot API.

  5. Custom Code nodes filter out internal or hidden HubSpot fields and attach the CRM object type to each property entry.

  6. Finally, the Google Sheets n8n node appends this clean, validated list of HubSpot properties to the spreadsheet. This is a crucial foundation for the subsequent import phase.

Phase 2: CSV Data Import (Execution)


  1. The import starts via the 'File upload form' n8n trigger, where the user uploads the CSV and selects the target HubSpot object type.

  2. The input file is analyzed: the 'Extract From File' n8n node identifies the CSV header row (the input fields) and the main body data.

  3. The workflow uses the Google Sheets n8n node to retrieve the valid HubSpot properties specifically for the selected object type.

  4. A Code n8n node compares the CSV headers against the valid HubSpot properties.

  5. An If n8n node branches the execution:

a. Success Path: If all fields match, the data is prepared for upload.
b. Mapping Path: If fields are missing, a dynamic n8n Form is presented to the user, allowing them to manually map their uploaded CSV field names (e.g., 'CustID') to the correct HubSpot property name (e.g., 'customer_id').

  1. After mapping or direct validation, the data is split into individual records.

  2. An HTTP Request n8n node uploads each record using the HubSpot API.

  3. The n8n workflow concludes by displaying a successful completion message.

Installation Guide

To deploy this advanced n8n workflow, follow these steps:

1. Import the n8n Workflow


  1. Copy the provided n8n workflow JSON.

  2. In your n8n instance, navigate to 'Workflows' and click 'New'.

  3. Click the 'Import from JSON' button and paste the copied data.

2. Configure Credentials

This n8n template requires credentials for two services:

HubSpot OAuth2 API: You must configure credentials for HubSpot in your n8n settings. This is used by the 'Fetch properties from Hubspot' and 'Uploads to Hubspot' n8n node instances.
Google Sheets OAuth2 API: Configure Google Sheets credentials. This account needs read/write access to the spreadsheet that will store the HubSpot properties.

3. Google Sheet Setup


  1. Create a new Google Sheet (e.g., named 'Properties for Hubspot').

  2. Locate the Document ID and Sheet Name (often 'Sheet1' or 'gid=0').

  3. Update the Document ID and Sheet Name parameters in the following n8n node instances within the workflow:

'Erase Google sheet'
'Append to Google sheet'
* 'Get the fields from the sheet'

4. Initial Run: Update Properties


  1. Run the first execution path manually: Click the 'Start here to update your field list' n8n trigger node and execute the workflow. This will populate your Google Sheet with current HubSpot properties, enabling the subsequent CSV import process.

Node Details

File upload form (n8n trigger): The primary n8n trigger for the import flow. It captures the CSV file and the user's desired CRM object type (e.g., Companies, Contacts).
Fetch properties from Hubspot (HTTP Request n8n node): Calls the HubSpot CRM API to retrieve all property definitions for the specified object type, requiring HubSpot OAuth credentials.
Erase Google sheet / Append to Google sheet (Google Sheets n8n node): Used in the setup flow to clear the existing properties list and then write the newly fetched list of properties into the designated spreadsheet.
Set the real fields (Set n8n node): Extracts the CSV column headers (field names) from the uploaded file for comparison against HubSpot properties.
Check if all fields from input are defined (Code n8n node): Contains critical custom scripting logic to compare the list of CSV field names (keys) against the valid HubSpot property names (props) fetched from the Google Sheet.
If all fields are defined (If n8n node): Controls the branching logic, directing the flow either to direct data processing (if fields match) or to the manual mapping form.
Form to set the correponding field for each input field (Form n8n node): This dynamic n8n node displays a web form when mismatches occur, asking the user to manually select the correct HubSpot field name for each unknown CSV column.
Uploads to Hubspot (HTTP Request n8n node): The final action n8n node, responsible for sending the processed, mapped data records (in JSON format) to the correct HubSpot API endpoint (Note: Users should ensure the URL expression dynamically references the selected object type if they modify this n8n template).

Related n8n Workflows

Paid

Nodes: 13 Nodes
Updated: December 26 2025
View all
Created by

We create bespoke AI solutions, automations and agents that help your business as it scales.

Featured*