Excel to SQL common errors

Typical errors when running generated scripts and how to fix them.

! Invalid column name

Cause

Excel column names don't match DB fields, or spaces/special chars weren't mapped correctly.

Fix

Edit column mappings to match exact database field names, including case and spaces.

! Conversion failed

Cause

Excel cell is text but DB column is numeric, or date format doesn't match SQL Server.

Fix

Fix column formats in Excel (number/date) or clean non-numeric chars before regenerating.

! PRIMARY KEY violation

Cause

INSERT data duplicates existing primary key or unique index values.

Fix

Check for duplicate IDs in Excel, or use UPDATE instead of INSERT for existing rows.

! Cannot insert NULL

Cause

Empty Excel cells produce NULL but the DB column is NOT NULL.

Fix

Fill empty cells in Excel or set a default value on the database column.

! Unclosed quotation mark

Cause

Unescaped single quotes in data, or manual script edits broke string quoting.

Fix

The tool escapes quotes automatically. Regenerate instead of hand-editing string values.

! Script timeout / transaction log full

Cause

Running tens of thousands of INSERTs in one transaction causes timeout or log growth.

Fix

Split Excel into smaller files and add GO every 1000 statements to batch commits.