How to import Excel data into SQL

Excel and SQL disagree about data types, which is why a straight copy-paste usually fails. This guide covers what to watch for when converting a workbook into INSERT statements.

Pick the right sheet first

A workbook may have several sheets. Decide which one holds the data rows; most tools, including this one, read the first sheet and tell you its name.

Dates, times, and leading zeros

Excel stores dates as numbers. When converting, dates should become YYYY-MM-DD, or YYYY-MM-DD HH:MM:SS when a time is present.

Cells formatted as zero-padded text, such as postal codes, must keep their leading zeros and stay quoted in SQL.

Formula cells and formatting

Formula cells should use the calculated value stored in the file, not the formula text. Currency and percentage formatting should be dropped so only the underlying number remains.

Generate the INSERT statements

Once the sheet is read, name the target table, choose the dialect, and set the batch size. Review the detected column types before you run the statements.

Do it in your browser

Frequently asked questions

Does it convert formulas?
It uses the value Excel last calculated and stored, not the formula string.
Can it read .xls as well as .xlsx?
Yes, both are supported and both are parsed locally.
Is the workbook uploaded?
No. Excel parsing runs in your browser in a Web Worker.

Keep reading