On this page
Insert creates new records. Update changes records that already exist. Upsert does one or the other, row by row: it updates a record if it finds a match and creates one if it does not. Pick the operation by asking whether the records already exist, and how you will match each row in your file to a record in Salesforce.
This guide explains each operation, how to choose a reliable way to match rows to records, and what goes wrong with duplicates and blanks.
Know what each operation does
| Insert | Update | Upsert | |
|---|---|---|---|
| Looks for an existing record first? | No | Yes | Yes |
| Exactly one match | Creates a new record anyway (a duplicate) | Updates that record | Updates that record |
| No match | Creates a new record | Row fails | Creates a new record |
| More than one match | Creates a new record anyway | Row fails | Row fails |
Within a tool, update and upsert find records the same way. The only difference is what happens when nothing matches: update reports the row as failed, upsert creates a record.
Use insert when every row is new
Insert never looks for existing records. Unless a duplicate rule or a unique field stops it, run the same file twice and you get every record twice.
Use it for genuinely new data: a first load into an empty object, a batch of new leads from an event, or child records such as line items that cannot already exist. If the file might overlap with data already in Salesforce, insert is the wrong choice.
Use update when the records already exist
Update changes fields on records that are already in Salesforce. Each row must match exactly one record. The record ID works, but most people don’t have it in their spreadsheet, so matching on the fields they do have is more common: an order number, an email address, or a combination of fields. How a tool finds the record varies. Data Loader updates by Salesforce record ID only, and upserts on the record ID or one External ID field. The Data Import Wizard matches on set fields, such as a contact’s or lead’s email. Matching on other fields, or a combination, depends on the tool. Zero matches or more than one means the row is not updated.
Use it for corrections and mass changes to a field. Refreshing prices from a supplier’s price list is a classic example. Update is strict, and that is the point: a row for a record that doesn’t exist fails instead of quietly creating a stray record.
Use upsert when the file mixes new and existing rows
Upsert matches each row the same way update does. If it finds one record, it updates it. If it finds none, it creates one. Salesforce recommends upsert over insert in most cases to avoid unwanted duplicates.
Use it for files you load again and again, such as a weekly export from another system. Rows you have already loaded are updated, new rows are created, and nothing is doubled.
Choose how to match rows to records
Update and upsert are only as good as the match. Before you import, decide what identifies one real-world record in both your file and Salesforce.
- Try a single field first. Good candidates are values that are unique and never change: the Salesforce record ID, an order number, an invoice number, or a customer number from your finance system.
- Combine fields when no single one is unique. A name alone is not enough; plenty of people share one. First name, last name and email together usually are. Every field in the combination has to match, so a combined key is stricter than any one of its parts. Not every tool can match on more than one field, so check yours first.
- Check the key is unique in Salesforce. Build a report or list view grouped by your key fields and look for any group with more than one record. Merge or remove those duplicates before you import; they will block the match either way.
- Check the key is unique in your file. Sort by the key columns, or count each value, and look for repeats.
- Make the values look the same on both sides. Trim spaces, and use the same format for phone numbers, dates and codes.
ACME-001with a trailing space is a different value fromACME-001.
Write the key down. Next time you load the same kind of file, use the same match.
Know what happens with duplicates, blanks and missing parents
Most upsert problems come from the match, not the operation.
- More than one match. Salesforce will reject the row rather than guess which record you meant. Remove the duplicates, then make the key stricter, for example by adding a second field, so it doesn’t happen again.
- Blank values. A blank cell can’t match anything, so an upsert creates a new record for it. Treat a blank key as a row to fix before loading.
- Formatting. Different spacing, punctuation or date formats look different to Salesforce even when they look the same to you.
- Missing parent. A child record, such as an opportunity product, needs its parent opportunity to exist first. Load parents before children, or use a tool that can import a parent and its children together in one pass.
Choose with three questions
Do all the rows already exist in Salesforce?
If yes, use update.
Are all the rows new?
If yes, use insert. Check for overlap first.
Is it a mix, or can you not be sure?
Use upsert, with a reliable matching key.
A fourth check helps: should a missing record be an error? If so, use update. If a missing record should simply be created, use upsert.
Fix common errors
| Symptom | Likely cause | Fix |
|---|---|---|
| Duplicates after an upsert | The match failed: blank, extra spaces or different formatting | Clean the key columns and check existing records hold the same values |
| Row rejected for matching several records | Two or more records share the key | Remove the duplicates, then add a field to the match |
| Update fails for some rows | No record matches those rows | Check the key values, or use upsert if those rows should be created |
Read the error file after every run. Different tools handle failures in different ways. If the import saved the good rows, fix the failed rows and load only those. If the whole file was rejected or rolled back, fix the problem rows and load the complete file again.
Doing this in Impowr
If you’re the one who understands matching, you probably end up running every import yourself. Impowr® lets you get it right once, then hand it over.
Set it up for yourself
Save the import type and the fields that identify a record in a mapping. Next time, upload the file to the same component and it runs exactly the same way.
Then delegate it
Give the same mapping to the colleague who owns the spreadsheet. They just upload: no import types or matching rules to choose, and the import runs with their own Salesforce permissions. Impowr shows them exactly which rows need fixing, so fewer questions come back to you.
The Free plan covers you as the admin plus one colleague, so you can hand over your first import today. When more people need it, Team and Enterprise add more users, undo and all-or-nothing imports.
Frequently asked questions
Often, but not always. Upsert needs a reliable way to match each row to a record. If you don’t have one, or a missing record should be treated as an error, use update. If every row is genuinely new, insert is simpler.
Nothing is written for that row. A match on more than one record returns an error which will typically prompt the user to fix it. Fix the duplicates in Salesforce, or choose a field that is unique, then run the row again.
Usually the match failed. Check for blank cells, stray spaces, or values formatted differently in the file and in Salesforce. A row with no match is created as a new record, which is exactly what upsert is designed to do.
A value that identifies one real record and exists in both your file and Salesforce. That can be the record ID, an order or customer number, or, if your tool can match on more than one field, a combination such as first name, last name and email. Combining fields makes the match stricter.
No. Update only changes records it can match. A row with no match fails and is reported, so nothing new is created by mistake.
