Update Data: Add or Replace Records From a File
Got a new wave of data, or corrections to records you already have? You can bring them into an existing data store from a file. Data Wrangler matches your file’s columns to the data store’s variables, and uses the primary key to tell new records from existing ones.
There are two ways to do it. Import Data on the data store page adds data to the variables you already have. Update Existing Data on the Data Wrangler home can also add new variables from your file.
Which route to use
Section titled “Which route to use”| Import Data | Update Existing Data | |
|---|---|---|
| Where | The data store page header | Data Wrangler home → data store row → More |
| Columns not in the data store | Ignored | Added as new variables |
| Data stores | Any data store with variables | Data stores of type Data Store or File: ones created in Data Wrangler, file uploads and most wrangle outputs |
| Layout | One dialog | Three steps: File Upload, Variables, Output |
So: use Import Data for more of the same data, and Update Existing Data when your file also has new columns to add.
Both accept the same files as creating a data store: .csv, .xls, .xlsx, .sav, and .zip files containing a .sav. Column names are matched to variable names whatever their capitals, and spaces in your headings are read as underscores, so “Q1 Score” matches q1_score.
Choose how your data is applied
Section titled “Choose how your data is applied”Both routes ask how your file’s rows should meet the records already in the data store. The options have slightly different names:
| Import Data | Update Existing Data | What happens |
|---|---|---|
| Insert Data (default) | Add Data (cases or variables) (default) | Adds new records. The import fails if any record’s primary key already exists. |
| Update Data | Update Data (cases or variables) | Updates existing records. The import fails if your file has primary keys the data store hasn’t seen. |
| Insert and Update Data | Add and Update Data | Adds new records and updates existing ones in one go. |
| Replace All Data | Replace All Data | ”First deletes the existing data, then replaces it with the data in your new file.” |
Update and Insert and Update need a primary key. If the data store doesn’t have one, every row in your file is added as a new record.
If anything goes wrong, nothing changes: the whole file is applied, or none of it is.
Import Data
Section titled “Import Data”-
Click Import Data - It’s in the data store page header. The Import Data dialog opens: “Select the file containing the data to import into this data store.” It also tells you up front: “Columns that do not exist in the data store will be ignored.”
-
Add your file - Drag it onto Drop File Here, or browse for it, and wait while you see “Analysing Data …”. The uploader also shows a First Row as Headers checkbox.
-
Check the summary - It shows how many “rows ready to import”, how many “columns matched”, and how many “columns will be ignored”. Below that, you’ll see any warnings, such as a column that may not match its variable’s type, and any personal-information warnings.
-
Fix any errors - IMPORT stays turned off until there are no errors. Warnings don’t stop you, but check them first: a type warning can make the import fail. See Common Issues.
-
Choose an Import Action - See the options.
-
Click IMPORT - A progress bar appears: “Do not close this page while the data is being imported.”
-
Check the result - You’ll see “Process Complete. Your data import is complete.” with what changed, for example “20 cases added.” and, if any records were updated, “2 cases updated.” Click Close, then Refresh Data to see the new records.
If your file has labels instead of codes for a variable with a codeframe, like “Very satisfied” instead of 1, Data Wrangler converts them for you and says how many columns it converted. Values that match neither a code nor a label stop the import.
Update Existing Data
Section titled “Update Existing Data”-
Open the data store’s menu - On the Data Wrangler home, hover over the data store and click More → Update Existing Data. The full-screen Update Existing Data window opens.
-
File Upload: add your file - Read the note: “This process is irreversible. You may wish to consider exporting your current data before you proceed.” Then add your file.
-
Variables: review and choose - Check the list of variables. New columns show as New Variable, and columns missing from your file are flagged. Choose how to apply the data (see the options). Fix any errors in Import Notifications before you continue.
-
Output: preview - “Preview your data before committing the upload.”
-
Click Apply - When it’s finished, you’ll see “Process Complete. Your file has successfully loaded and your data update is complete.” with the number of columns and cases added and updated.
A few things to know:
- Primary key: if the data store has one, your file must include it.
- New columns become new variables. You can choose how to handle personal information in them on the Variables step.
- Missing columns are fine, unless one of them is the primary key.
- Types must match: a column whose values don’t fit the existing variable’s type stops the update.
After the update
Section titled “After the update”- A successful import publishes the data store if it was in Draft. See Publish & manage a data store.
- New records appear in Data View once you click Refresh Data.
Frequently Asked Questions
Section titled “Frequently Asked Questions”Which should I use, Import Data or Update Existing Data?
Use Import Data when your file has the same columns as the data store. Use Update Existing Data when it also has new columns you want to add as variables.
Why don’t I see Update Existing Data?
It’s only offered for data stores of type Data Store or File: ones created in Data Wrangler, file uploads and most wrangle outputs. For survey data stores, data stores created by other apps and weighting outputs, use Import Data on the data store page.
Why don’t I see Import Data on the data store page?
The data store is empty (use the Import Data card instead; see Create a data store), or you don’t have Can Edit access.
What happens to columns that aren’t in the data store?
Import Data ignores them. Update Existing Data adds them as new variables.
Can I undo an import?
No. Update and Replace All Data change records in place. To remove records you added by mistake, see Edit & delete records.
Do I need a primary key?
Only to update existing records. Without one, every row is added as a new record. See Primary keys.
Common Issues and Solutions
Section titled “Common Issues and Solutions””Missing primary key variable(s): …”
Section titled “”Missing primary key variable(s): …””Your file doesn’t include the data store’s primary key column.
- Add the column - Include the primary key column, with the same name, and upload the file again.
”Primary key ”…” contains blank values.” or “Duplicate primary key values were found in the uploaded file.”
Section titled “”Primary key ”…” contains blank values.” or “Duplicate primary key values were found in the uploaded file.””Every row needs its own primary key value.
- Fix the file - Fill in the blanks and remove duplicate rows, then upload it again.
”Insert new data failed because primary key already exists.”
Section titled “”Insert new data failed because primary key already exists.””You chose Insert Data, but some rows in your file are already in the data store.
- Choose another option - Use Insert and Update Data to add new records and update existing ones together.
”Update data failed because primary key contains new values.”
Section titled “”Update data failed because primary key contains new values.””You chose Update Data, but your file has rows that aren’t in the data store yet.
- Choose another option - Use Insert and Update Data (or Add and Update Data) instead.
”Column ”…” has values that don’t match any codeframe label: …”
Section titled “”Column ”…” has values that don’t match any codeframe label: …””Some values are neither a code nor a label in that variable’s codeframe.
- Fix the values - Correct them in your file, using the codes or labels from the codeframe.
- Or update the codeframe - Add the missing codes first. See Codeframes.
”Column ”…” may not match the existing variable type.”
Section titled “”Column ”…” may not match the existing variable type.””Import Data warns that a column’s values don’t look like its variable’s type, such as day-first dates in a Date variable. It’s only a warning, so IMPORT still works, but the import can then fail with “The import has failed. For support, please contact us.” and “Process Failed. Your file could not be imported.”
- Fix the column’s values - Correct them in your file so they match the variable’s type. For dates, use the format the variable expects. Dates in
yyyy-MM-ddformat, for example2026-09-22, are the most reliable. - Import again - Add the corrected file and check that the warning has gone before you click IMPORT.
”Data type provided does not match existing variable’s type, please fix file data to proceed.”
Section titled “”Data type provided does not match existing variable’s type, please fix file data to proceed.””A column in your file has values that don’t fit the variable’s type, such as text in a number column.
- Fix the file - Correct the values in that column, then upload it again.
”The import has failed. For support, please contact us…”
Section titled “”The import has failed. For support, please contact us…””The import couldn’t be submitted. The message may include an Import Request reference.
- Check your access - You need Can Edit access to the data store.
- Contact support - Use the contact us link. Quote the reference, and the data store’s name and GUID (copy it from Settings).