Logo

How to Convert a CSV File to Excel (XLSX)

Converting a CSV file to XLSX looks trivial, open it in Excel and hit "Save As". It's also the easiest way to silently corrupt product codes, phone numbers, and dates before anyone notices. Here's what actually happens during the conversion, and how to do it without losing data.

Why This Isn't Just a File Extension Change

CSV stores everything as plain text. XLSX stores typed cells, text, number, date, currency, and Excel decides the type the moment it opens the file, before you've told it anything. That auto-detection is where data breaks:

  • Leading zeros disappear: a ZIP code or SKU like 00423 becomes 423 because Excel reads it as a number.
  • Long IDs turn into scientific notation: a 16-digit account or card number becomes 4.35678E+15, and the original digits are unrecoverable once saved.
  • Dates get reinterpreted: 03/04/2025 is read as March 4th or April 3rd depending on the system's regional format, with no warning either way.
  • Text that looks numeric gets coerced: version strings like 1.10 collapse to 1.1.

The core problem: a plain "open and save" conversion never asks you what each column should be, it guesses, and the guess is wrong often enough to matter for IDs, codes, and dates.

Method 1: Excel's Text Import Wizard

Instead of double-clicking the CSV (which triggers the auto-detection above), import it deliberately: Data โ†’ Get Data โ†’ From Text/CSV. This opens a preview where you can set the data type per column before anything is loaded, set ID or code columns to Text explicitly, and Excel will preserve leading zeros and long digit strings as written. Once imported, save as XLSX.

This method is reliable but manual, it doesn't scale past a handful of files and has to be repeated correctly every time.

Method 2: Google Sheets

Google Sheets applies the same kind of auto-detection as Excel on import, so it has the identical leading-zero and scientific-notation risks. The workaround is the same idea: prefix risky values with an apostrophe ('00423) or pre-format the column as Plain Text before pasting, then export as File โ†’ Download โ†’ Microsoft Excel (.xlsx).

Method 3: Programmatically (pandas)

For repeatable conversions, pandas gives you explicit control over every column's type instead of relying on inference:

import pandas as pd
df = pd.read_csv("data.csv", dtype={"zip_code": str, "account_id": str})
df.to_excel("data.xlsx", index=False, engine="openpyxl")

The dtype argument is the important part, it forces specific columns to stay as text through the entire read/write path, which is what actually prevents the leading-zero and scientific-notation problems, not the file format itself.

The Fastest Way: A Browser-Based Converter

If you don't want to open Excel, install a Python environment, or fight the import wizard for a one-off file, a dedicated CSV to XLSX converter does the type detection correctly by default, assigning text, number, and date types up front instead of guessing after the fact, and produces a real .xlsx workbook with no macros or upload step.

Checklist Before You Trust the Result

  • Open the XLSX and check any ID, code, or ZIP column still has its original digit count and leading zeros
  • Check dates render as actual dates, not text or the wrong day/month swapped
  • Compare row counts between the CSV and XLSX, a broken delimiter or unescaped comma can split or merge rows
  • If the source file uses a non-UTF-8 encoding, verify special characters didn't turn into garbled symbols (see CSV encoding issues)

Doing This in How To CSV

How To CSV's CSV to XLSX tool assigns correct cell types (text, number, date) before writing the file, so codes like 007 and IDs like 01-234 stay intact, no manual import wizard required. Everything runs client-side, so the file never leaves your browser. If the source data also needs cleanup first, see how to clean a CSV file, and if dates are ambiguous across regions, see the CSV date formatting guide.

Ready to convert your file?

Convert CSV to a native XLSX workbook instantly, with correct types preserved, entirely in your browser.

Convert CSV to XLSX

Turn this into a saved workflow

Create a free account to save the steps from this guide as a reusable workflow and re-run it on any file, from any device.

Sign in for free

Follow HowToCSV on Google

Add us as a preferred source on Google Search so our latest CSV guides and tutorials surface more often in your Top stories.

Add HowToCSV as a preferred source