Importing Multiple Of The Same Object Per Company/Contact

Hope you're all well.


I wanted to import multiple notes I had per company into hubspot.


Problem was that, when imported, it would create a separate company (of the same name), each with a unique note. If I had 4 notes on a company, it would create 4 separate companies, each with it's own note.


Hubspot also currently doesn't have the functionality to bulk merge companies (I have 4.5k companies in my database, would be extremely impractical to merge the notes together manually).


I created and used the attached script, where it takes in a company's ID, and then will combine all the notes into one box, delineated with a "|" character, and output to a new csv. When that new csv is uploaded, you will have your notes all together per company.


Not a perfect solution -but the script can be adapted in case you have multiple names, phone numbers, other IDs, etc (any field), that you want to combine per ID, company name, contact name (anything).


To do this, open a code editor or vim in terminal, and run the script below.


If you have linux/ubuntu, requirements are:

pip install python

pip install pandas

and run by typing: python3 run



import pandas as pd

# Load the input CSV file into a pandas DataFrame
input_file = 'merge.csv'
df = pd.read_csv(input_file)

# Initialize an empty list to store the DataFrames for each unique ID
result_dfs = []

# Iterate through unique IDs
unique_ids = df['ID'].unique()
for id in unique_ids:
    # Filter rows with the current ID
    id_rows = df[df['ID'] == id]
    # Concatenate the notes for the current ID with "|" separator
    merged_notes = '|'.join(id_rows['notes'])
    # Take the first row (assuming other columns are the same) and set the merged notes
    first_row = id_rows.iloc[0].copy()
    first_row['notes'] = merged_notes
    # Append the row to the list

# Concatenate the list of DataFrames into the result DataFrame
result_df = pd.concat(result_dfs, axis=1).T

# Save the result to a new CSV file
output_file = 'output.csv'
result_df.to_csv(output_file, index=False)

print(f"Processed {len(result_df)} records. Saved to {output_file}")
1 Reply 1
Key Advisor | Partner
Key Advisor | Partner

Importing Multiple Of The Same Object Per Company/Contact

Hey @JustinCT  out of curiosity did you use a company domain name in your import and map it to the default company domain name field? HubSpot should add all imported data to the same company record if the company domain name matches as it de-dupes on this property.


Tom Mahon
HubSpot Expert | Digital Marketing Specialist | Community Champion

Book a meeting

Did my post help answer your query? Help the community (and me) by marking it as a solution.