How to Import and Map CSV Columns into an Access Table
Question details
The user needs to import a CSV file into an existing Access database table and properly map the columns because the source file and destination table have different structures.

- Product
- Microsoft Access
- Device & OS
- not provided
- Scenario
- Importing external CSV data with inconsistent headers into an established database table.
- Observed behavior
- The source CSV file and destination Access table have differing field names and column orders, requiring explicit column mapping to correctly append the data.
Ensure your CSV file is closed before importing to avoid file lock errors, and verify that the data types in your CSV match the destination table's fields to prevent import failures.
Use the External Data Wizard and an Append Query
The most reliable method is to import or link the CSV as a staging table first, then use a SQL Append Query to map the differing fields.
Directly importing a CSV into an existing table often fails if the columns don't match exactly. Creating a temporary staging table allows you to manually map differing field names safely.
Navigate to the 'External Data' tab on the Access ribbon and click 'New Data Source' > 'From File' > 'Text File'. Select your CSV file and choose to import or link it as a new table (e.g., 'CsvTable'). Complete the wizard ensuring the 'First Row Contains Field Names' box is checked.
Go to the 'Create' tab and select 'Query Design'. Close the 'Show Table' dialog that pops up, right-click the query tab, and switch to 'SQL View'.
Write an INSERT INTO query to map the fields. For example: INSERT INTO MainTable (ClientName, RevenueType, ContractNumber) SELECT Client, RevenueType, [Contract#] FROM CsvTable; (List only the destination fields that should receive data).
Click the 'Run' button (the red exclamation mark) on the Query Design ribbon to execute the mapping and append the data from your CSV staging table into your main table.

Automate the Import Using VBA and DoCmd.TransferText
If you need to automate the process, you can write a VBA script utilizing the DoCmd.TransferText method.
Looking for a Free Office Suite for Your Data Tasks?
While Microsoft Access requires a paid subscription, WPS Office provides a free, lightweight, and robust suite for your daily documentation, presentation, and data analysis needs. WPS Spreadsheets excels at opening, editing, cleaning, and managing CSV files seamlessly, serving as an excellent companion for handling tabular data.

Frequently Asked Questions
Why do I get a data type mismatch error when running the append query?
This occurs when the data type in your CSV staging table does not match the destination table. For instance, trying to insert text into a Number or Date field will trigger this error. Verify the field properties in both tables before appending.
Can I directly import a CSV into an Access table without a staging table?
Direct import is only reliable if the CSV columns exactly match the destination table's field names, order, and data types. If they differ, using a staging table and an append query is the recommended and safest approach.
How do I save my CSV import specification for future use?
During the External Data Text Import Wizard, click the 'Advanced' button to review your field mappings, then click 'Save As' to store the specification name. You can reference this name later in saved imports, macros, or VBA code.
What happens if a column exists in the destination table but not in my CSV?
In your INSERT INTO query, simply omit the destination field name that doesn't have a corresponding CSV column. Access will leave that field blank (Null) or apply its default value during the append process.




