All posts
    Guideshow to convert a csv file to excel

    How to Convert a CSV File to Excel: 5 Methods That Preserve Your Data (2026)

    Convert a CSV to Excel without breaking leading zeros, dates, or long IDs. Five methods for Windows, Mac, Google Sheets, and bulk conversion, compared.

    November 22, 202617 min readCarbonApps Team

    Most guides to converting a CSV to Excel stop at "File > Open," which is also the fastest way to silently wreck your data. If your spreadsheet has zip codes, SKUs, phone numbers, or dates in it, the easy method is often the wrong one.

    CSV vs. Excel: What Actually Changes When You Convert

    A CSV and an XLSX file look similar once they're open in a spreadsheet grid, but they are fundamentally different kinds of files, and that difference is exactly why conversions go wrong.

    What a .csv file really is (plain text plus delimiters)

    A CSV (comma-separated values) file is plain text. Every value is just a string of characters separated by commas, with no concept of a "number," a "date," or a "currency." A cell containing 00123 is stored as the four characters "00123," nothing more. There is no formatting, no formulas, and no metadata about what the data is supposed to mean. That simplicity is also the appeal: CSVs are small, universal, and readable by virtually every system, database export tool, and programming language.

    What .xlsx adds (formatting, formulas, multiple sheets, data types)

    XLSX is a structured file format (technically a zipped bundle of XML files) that stores not just values but also data types, number formats, formulas, multiple worksheets, cell styles, and more. When you convert a CSV to XLSX, Excel has to make a judgment call about what each plain-text value "should" be. That judgment call is where leading zeros disappear, long account numbers turn into scientific notation, and 03/04 becomes a date instead of a fraction.

    Why conversion is lossy in both directions

    Conversion is rarely perfectly reversible. Going from CSV to XLSX, you risk Excel "helpfully" reinterpreting your data. Going from XLSX to CSV, you lose everything that isn't a raw value, including formulas (which get flattened to their last calculated result), multiple sheets (only the active sheet exports), and formatting. Understanding that both directions are lossy, in different ways, is the mental model that makes the rest of this guide make sense.

    Method 1: Open and Save As (The Fast Way, and Its Trap)

    This is the method almost everyone tries first, and it works fine for simple data. It is also the method most likely to quietly corrupt the columns you care about most.

    Open the CSV in Excel

    Double-click the CSV file, or open Excel and use File > Open, then select the CSV. Excel will immediately parse the file into its grid using its default import logic, which tries to guess the data type of every column.

    Save As > Excel Workbook (.xlsx)

    Once the file is open, go to File > Save As, choose a location, and select "Excel Workbook (*.xlsx)" from the file type dropdown, as described in Microsoft's own guidance on importing and exporting text and CSV files. The file now has an .xlsx extension and can hold formulas, formatting, and multiple sheets going forward.

    The leading-zero and date-mangling problem this causes

    Here is the trap: Excel's default CSV parser applies "General" formatting to every column, and General formatting aggressively reinterprets text that looks numeric or date-like. A zip code of 02134 becomes 2134. A product ID of 4.56E+12 that was actually meant as text gets flattened into scientific notation and the original digits are gone for good, even if you later reformat the cell. A date column written as "03-04" might get read as March 4th of the current year instead of the literal text you intended. Once Excel has already reparsed and saved the file, the original values are not recoverable from the XLSX, only from the source CSV. Microsoft documents this exact failure mode in its support article on stopping Excel from automatically changing numbers into dates. If your data has IDs, codes, or anything with leading zeros, skip straight to Method 2.

    Method 2: Import with Power Query / Get Data (The Safe Way)

    If Method 1 is the fast way, this is the correct way for any file that has codes, IDs, phone numbers, or dates you don't want Excel guessing about.

    Data > From Text/CSV

    Instead of opening the file directly, open a blank Excel workbook, go to the Data tab, and choose "From Text/CSV" (sometimes labeled "Get Data > From File > From Text/CSV" depending on your Excel version). This routes the import through Power Query, which gives you a preview and control over how each column is interpreted before anything touches your worksheet. Microsoft's walkthrough on getting data from text and CSV files with Power Query covers the full dialog.

    Setting column data types before load

    In the Power Query editor, you can click each column header's data type icon and explicitly set it to Text, Whole Number, Date, or another type, before the data ever lands in a worksheet cell. This is the single most important step in the whole guide: setting a column to "Text" before load means Excel will never try to reinterpret it, no matter how numeric it looks.

    Why this preserves ZIP codes, phone numbers, and long IDs

    Because you are telling Excel what the data is, rather than letting Excel guess, a zip code column set to Text keeps its leading zeros, a phone number keeps its formatting, and a 16-digit account number stays as a literal string instead of collapsing into scientific notation. Once you click "Load," the result lands in your sheet exactly as specified, and you can then use Save As to store it as an XLSX file. For any CSV export from a database, CRM, or billing system, this method should be your default, not your backup plan.

    Method 3: Converting on Mac (Numbers and Excel for Mac)

    Mac users have two reasonable paths, and the quirks are different enough from Windows that they deserve their own method.

    Excel for Mac import quirks

    Excel for Mac supports the same Data > From Text/CSV and Power Query workflow described in Method 2, and Microsoft's CSV import documentation applies to both platforms. The main difference is regional settings: Mac's system locale can affect how Excel interprets decimal separators and dates during a plain double-click open, so the Power Query route is even more worth the extra two clicks on Mac.

    Using Apple Numbers as an intermediary

    Apple's Numbers app can open a CSV directly and export it as an XLSX file through File > Export To > Excel. Apple's own guide to importing files into Numbers explains supported formats. This can be a useful intermediary step if you don't have Excel installed, though Numbers applies its own automatic formatting rules on import, so the leading-zero problem from Method 1 can still occur here. Treat Numbers as a convenience option for simple, non-sensitive data, not a substitute for Power Query when the data has codes or IDs.

    Encoding issues with UTF-8 CSVs

    CSVs exported from web applications, databases, or non-English systems are frequently saved in UTF-8 encoding, and if the importing application assumes a different encoding, accented characters, currency symbols, or non-Latin text can render as garbled characters. Both Excel's Get Data dialog and Numbers let you specify the file encoding during import, so if you see unexpected symbols after opening a CSV, redo the import and explicitly select UTF-8 rather than letting the default encoding guess for you.

    Method 4: Google Sheets as a Free Converter

    If you don't have Excel installed, or you just need a one-off conversion, Google Sheets handles the job without any software purchase.

    Import the CSV into Sheets

    Open Google Sheets, select File > Import, and upload the CSV. Google's help documentation on importing and exporting files in Sheets covers the import dialog, including options for separator type and whether to convert text to numbers and dates automatically (an option worth disabling for the same reasons described in Method 1).

    Download as .xlsx

    Once the data is in a Sheets file, go to File > Download > Microsoft Excel (.xlsx). Sheets converts the file format on its own servers and downloads a ready-to-use XLSX file, with no local software required.

    When this is better than desktop Excel

    This route is genuinely better than desktop Excel in a few specific cases: when you're working from a Chromebook or a machine without Excel, when you want to quickly share the converted file via a link rather than an attachment, or when you want a free, no-install way to double-check how a file will look before committing to a particular conversion method. For anything with sensitive IDs or codes, still disable Sheets' automatic type conversion during import, the same risks from Method 1 apply here too.

    Need to Convert Dozens of Files? (CTA)

    If you're converting one file a month, any of the methods above will do. If you're staring at a folder of fifty CSV exports from a CRM, a point-of-sale system, or a set of regional reports, manual conversion stops being a reasonable use of your time.

    When manual conversion stops scaling

    The breakeven point is usually smaller than people expect. Once you're opening more than a handful of files with the same structure on a recurring basis (daily exports, weekly reports, monthly reconciliations), the time spent repeating Save As dialogs adds up fast, and the risk of accidentally skipping the "set as Text" step on just one file goes up with every repetition.

    Bulk and automated options

    Method 5 below covers the two most practical bulk approaches: a short Python script and a PowerShell command, both of which can be pointed at a whole folder of files at once and run the same way every time. If your team is evaluating whether to build an internal tool for a recurring data pipeline, that's a conversation worth having with whoever owns your reporting workflow before you invest time scripting a one-off fix.

    Method 5: Bulk and Automated Conversion (Scripts and Tools)

    When you have many files, or the same conversion needs to run on a schedule, scripting beats clicking through dialogs every time.

    Python/pandas one-liner

    The pandas library can read a CSV and write it straight to XLSX in a few lines. Using pandas.read_csv to load the file and DataFrame.to_excel to write it out, you can explicitly set a column's dtype to string before export, which solves the leading-zero problem programmatically instead of relying on a GUI dialog. Writing the actual XLSX file requires an engine library such as openpyxl, which pandas uses under the hood. This approach is reproducible: once the script is written, it behaves identically on the hundredth file as it did on the first.

    PowerShell and command-line approaches

    On Windows, PowerShell's built-in Import-Csv cmdlet reads a CSV into structured objects, and the community-maintained ImportExcel module can export those objects directly to XLSX without Excel needing to be installed or running at all. This is a common choice for Windows-centric IT teams who want conversion built into an existing automation or scheduled task pipeline rather than adding a Python dependency.

    Scheduled/batch conversion

    Whichever scripting approach you choose, the pattern is the same: point the script at a folder, loop over every CSV file in it, apply consistent type rules (especially forcing ID-like and zip-code-like columns to text), and write each one out as XLSX. On Windows, this can be wired into Task Scheduler; on Mac or Linux, a cron job does the same thing. The result is a conversion process that runs the same way every time, with no risk of someone forgetting to change a column's data type in a dialog box.

    Fixing the Classics: Leading Zeros, Dates, Encoding, and Delimiters

    Four problems account for nearly every CSV-to-Excel complaint. Here's how each one happens and how to stop it.

    Preserving leading zeros and long numbers

    Leading zeros disappear because Excel's default CSV parser treats numeric-looking text as a number, and numbers don't carry leading zeros. Long numbers (16-digit card or account numbers, for example) can flip into scientific notation or lose precision because Excel's numeric type has a digit limit. The fix in every case is the same: set the column's data type to Text before the data loads into a cell, using Power Query (Method 2), a scripted dtype assignment (Method 5), or the equivalent explicit-type import step in Google Sheets or Numbers.

    Stopping Excel from auto-formatting dates

    Date auto-formatting happens because Excel tries to recognize common date patterns in plain text and convert them to its internal date serial number, which then displays using your system's regional date format. If you have a text field that merely resembles a date (a version number like 3-4, or a non-Gregorian date string), force that column to Text during import rather than letting it load as General or Date type.

    UTF-8 vs. ANSI encoding

    CSV files have no built-in metadata declaring their encoding, so applications have to guess, and guesses are sometimes wrong. A file saved with ANSI (Windows-1252) encoding that gets opened as UTF-8, or vice versa, will show garbled accented characters, curly quotes, or currency symbols. When you see that kind of corruption, redo the import and manually select the correct encoding rather than assuming the default is right; most import dialogs, including Excel's Get Data wizard and Google Sheets' import dialog, let you choose it explicitly.

    Comma vs. semicolon delimiters (regional settings)

    In locales where a comma is the decimal separator (much of Europe, for example), CSV exports from local software often use a semicolon as the field delimiter instead of a comma, to avoid colliding with decimal points. If a CSV opens in Excel with all your data crammed into a single column, this is almost always the cause. Power Query's import dialog lets you explicitly choose the delimiter, and this is one more reason to prefer the Method 2 workflow over a blind double-click open for any file you didn't create yourself.

    ProblemCauseFix
    Leading zeros vanishColumn auto-detected as NumberSet column type to Text before load
    Dates get rewrittenText pattern matches a date formatForce column type to Text
    Garbled accented charactersWrong encoding assumed on importManually select UTF-8 (or correct encoding)
    Data crammed into one columnDelimiter mismatch (comma vs. semicolon)Explicitly set delimiter during import

    Choosing the Right Method: A Quick Decision Guide

    With five methods on the table, here's how to pick the right one in under a minute.

    One file, trusted data to Save As

    If you're converting a single file, you created the data yourself (or trust the source completely), and there are no zip codes, IDs, or ambiguous dates involved, Method 1's plain Open and Save As is genuinely fine. It's fast, and the risk of silent corruption is low when the data is simple.

    Data with IDs/codes to Power Query

    If the file has anything that looks numeric but isn't meant to be treated as a number (zip codes, SKUs, account numbers, phone numbers, serial codes), use Method 2's Power Query import every time, regardless of platform. The ten extra seconds of setting column types is cheap insurance against data loss that you often won't notice until much later.

    Many files to script/bulk

    If you're converting more than a handful of files with the same structure, especially on a recurring basis, invest the time in Method 5's scripted approach. It is more consistent than any manual method and removes the chance of human error creeping in on file thirty-seven.

    ScenarioBest methodWhy
    Single simple file, trusted sourceMethod 1: Open and Save AsFastest, low risk for plain numeric/text data
    File has IDs, codes, or dates to protectMethod 2: Power Query / Get DataLets you set data types before load
    Working on a MacMethod 3: Excel for Mac or NumbersSame safeguards, Mac-specific import paths
    No Excel installedMethod 4: Google SheetsFree, browser-based, no install needed
    Dozens of files, recurring jobMethod 5: Script or batch toolConsistent, repeatable, no manual steps

    Frequently Asked Questions

    How do I convert a CSV to Excel without losing leading zeros? Use Method 2 (Data > From Text/CSV in Excel, or the equivalent Power Query import) and explicitly set the affected column's data type to Text before loading the data into the worksheet. Opening the file directly with File > Open and then Save As will not protect leading zeros, because Excel's default parser has already converted the column to a number by the time you see it.

    Why does Excel change my dates and long numbers when I open a CSV? Excel's default CSV import applies "General" formatting to every column and tries to guess each column's data type from its contents. Text that resembles a date gets converted to Excel's internal date format, and long numeric strings get converted to actual numbers, which can trigger scientific notation or precision loss. This behavior is documented directly in Microsoft's support article on automatic number-to-date conversion.

    How do I convert a CSV to Excel on a Mac? Use Excel for Mac's Data > From Text/CSV import (the same Power Query workflow available on Windows) for data with codes or IDs, or use Apple Numbers' File > Export To > Excel for simpler files, as described in Apple's Numbers import guide. Watch for encoding issues if the file includes accented or non-Latin characters.

    Can I convert a CSV to Excel for free without installing software? Yes. Google Sheets lets you import a CSV with File > Import and then export it as XLSX with File > Download > Microsoft Excel (.xlsx), entirely in the browser, as covered in Google's Sheets import and export documentation.

    How do I convert multiple CSV files to Excel at once? Use a script rather than repeating the manual process. A short Python script using pandas can loop through a folder and convert every CSV to XLSX with consistent column typing, and on Windows, PowerShell's Import-Csv combined with the ImportExcel module achieves the same result without needing Excel installed.

    What's the difference between a .csv and .xlsx file? A CSV is plain text with values separated by a delimiter (usually a comma) and carries no formatting, formulas, or data-type information. An XLSX is a structured file format that stores data types, formulas, multiple worksheets, and cell formatting, which is why opening a CSV in Excel requires Excel to interpret, and sometimes misinterpret, what each value is supposed to mean.

    Final Thoughts

    There's no single "correct" way to convert a CSV to Excel, there's only the right method for the data in front of you. Simple, trusted data can take the fast path through Method 1. Anything with IDs, codes, or dates deserves the extra thirty seconds Method 2's Power Query import takes to set column types explicitly. Mac users and anyone without Excel installed have solid free paths in Methods 3 and 4. And once you're converting the same kind of file over and over, Method 5's scripted approach pays for itself the first week you stop doing it by hand. The fastest way to corrupt a spreadsheet is to assume the default import settings know what your data means. They don't, and now you know how to tell them.

    Work with the studio

    CarbonApps is an independent venture studio in Los Angeles.

    Get in touch