
Converting Excel to SQL Insert Statements Safely and Fast
Turn a worksheet into SQL INSERT statements that quote text, handle NULLs and dates, and load in batches, or skip the script and use COPY or a driver.
Tag
49 posts

Turn a worksheet into SQL INSERT statements that quote text, handle NULLs and dates, and load in batches, or skip the script and use COPY or a driver.

Convert an Excel workbook to Parquet with pandas or DuckDB, fix column types first, write one file per sheet and check counts so analytics loads run fast.

Turn an Excel sheet of settings or tables into YAML in Python: shape the data, avoid the Norway problem and number traps, dump safely and validate.

Convert an Excel sheet to XML in Python: valid element names, escaping, elements versus attributes, encoding, large files and validation against a schema.

Convert an Excel sheet to JSON in Python: records, nested groups and JSON Lines, with typed values, ISO dates, nulls and a check that nothing was lost.

Export every sheet of an Excel workbook to its own CSV with pandas, openpyxl or LibreOffice, with safe file names, UTF-8, ISO dates and a manifest.

Convert Excel workbooks to CSV, JSON, XML and YAML without losing data: choose a format, read types, dates and headers, then verify with counts and schemas.

What survives when YAML becomes JSON, CSV, XML or Excel and back, with a tested loss matrix, the type traps in each direction and a conversion checklist.

Build XML from CSV rows without string templates that break on an ampersand. Use lxml or escape every value, and handle control characters and empty cells.

Convert an XML config to YAML so a person can read and diff it, and learn why a YAML 1.1 loader turns the strings no and NO into false and 0755 into 493.

Write an XML file into an xlsx workbook with openpyxl so numbers are numbers, booleans are booleans and identifiers stay text, and read it back to check.

Turn a nested XML file into a flat CSV with Python, joining repeated authors into one cell with correct quoting, and see why pandas read_xml dropped one.