Excel Import CSV and TXT Files: How It Works

How-to basics · Updated November 19, 2026

To import a CSV or TXT file in Excel for Microsoft 365 on Windows, choose Data > From Text/CSV, select the file, check the preview and delimiter, then choose Load or Transform Data. This import route gives you more control than opening a file directly, especially when you need to preserve text such as product codes or choose how dates and numbers are interpreted.

What CSV and TXT files contain

A CSV file stores rows of data as plain text, usually separating fields with commas. A TXT file is also plain text, but its columns may be separated by tabs, semicolons, spaces or another character. Some TXT files use fixed-width columns, where each field occupies a set number of character positions rather than being separated by a delimiter.

Neither format normally carries the full spreadsheet experience. A CSV file does not preserve multiple worksheets, cell formatting, charts or Excel formulas as working formulas. It is a portable way to exchange a table of values. TXT files can hold similar tabular data, but their layout depends on how the file was produced. Importing either file into Excel turns the text into a worksheet you can analyze and, if needed, save in Excel’s workbook format.

Import a file with the Data tab

Use the import command when you want to inspect how Excel will split and interpret the source data before it reaches a worksheet. The usual Windows steps are:

  1. Open a blank workbook or the workbook where the data should go.
  2. Select Data > From Text/CSV.
  3. Choose the CSV or TXT file, then select Import.
  4. Review the preview. Check the file origin or encoding and the delimiter if the columns do not look right.
  5. Select Load to place the data in a worksheet, or Transform Data to inspect and adjust it in Power Query first.

Depending on the dialog and workbook, the Load menu may offer a choice such as loading to a table or to a particular worksheet location. If you choose Transform Data, Power Query Editor opens. There you can remove unwanted columns, filter rows, change column types and make other changes before loading the result. The precise options shown can depend on the file and Excel build.

For a one-time, straightforward import, Load is often enough. For a recurring report or a file with inconsistent values, Transform Data gives you a repeatable set of steps. When the source file is updated, you can use Data > Refresh All to refresh connected queries, provided the source remains available at the expected location.

Choose the delimiter and encoding

The delimiter tells Excel where one field ends and the next begins. Comma is common in CSV files, but a file can use semicolons or tabs instead. A regional setting may also affect how a program creates CSV files: in some settings, a semicolon is used as the separator because a comma is used as the decimal mark. Do not assume every file ending in .csv is comma-delimited; trust the preview.

In the import preview, select the delimiter that makes the fields appear in separate columns. If a row of names and addresses appears as one long column, the chosen delimiter may be wrong. If names are split in the wrong places, the selected delimiter may occur inside the data, or the file may use a different structure. Properly quoted CSV fields can contain commas without being split into separate columns; for example, a value such as "Seattle, WA" is normally treated as one field by a CSV-aware importer.

Encoding controls how Excel reads characters. If accented letters, symbols or non-Latin text appear as question marks or strange characters, try a different file origin or encoding in the preview. UTF-8 is widely used for modern text files, but the source may have been saved in another encoding. A mismatch can damage how text displays even if the columns are split correctly. If you control the export, saving as UTF-8 CSV is a useful way to improve compatibility across systems.

Protect IDs, dates and other sensitive values

Excel tries to recognize data types, which is convenient for ordinary numbers and dates but can change values that should remain text. A code such as 00127 may become 127 if Excel treats it as a number. Long identifiers can also lose precision when interpreted numerically, and strings that resemble dates may be converted into date values. ZIP codes, account references, inventory codes and telephone numbers are often better kept as text even when they contain only digits.

To prevent unwanted conversions, choose Transform Data and set the relevant column’s data type to Text in Power Query before loading. If the column contains dates in a regional format, check how they are interpreted; for example, 04/05/2026 could mean April 5 or May 4 depending on the convention. In Power Query, a column’s type can be changed using the data-type control, and Change Type > Using Locale can be used when a specific locale is needed to interpret dates or decimal numbers.

Also check decimal and thousands separators in numeric data. A value such as 1.234 may represent a decimal number in one convention and a thousands-formatted value in another. Correcting the type after Excel has already converted or discarded information may not restore the original text, so inspect important columns before loading.

Load, transform and refresh the imported data

Power Query is useful when the import is more than a simple copy. It lets you shape the data before it enters the worksheet while keeping a record of the transformation steps. For example, a monthly sales export might contain an introductory row, several unnecessary columns and a date column that needs consistent interpretation. You can remove or promote rows, select columns, filter records and set data types before loading the result.

  • Load: Put the data into the workbook in a form suitable for sorting, filtering and analysis.
  • Transform Data: Open the Power Query Editor to clean or reshape the import before it is loaded.
  • Refresh: Re-read the source and repeat the saved query steps when the source data changes.

A refresh does not mean Excel will find a replacement file anywhere on your computer. The query depends on its source location and access. If a file is moved or renamed, the connection may need to be pointed to the new location. Keep a stable source path for recurring work, and check the refreshed output rather than assuming that every new export has the same columns and layout.

Importing by opening a file directly

You can also open many CSV files through File > Open, or by double-clicking the file in Windows. This is quick for a small, uncomplicated file. However, Excel may interpret fields automatically as it opens the file, and you may have fewer opportunities to review the delimiter, encoding and data types first. The exact behavior can be influenced by the file, Excel settings and regional settings.

If the file opens with all values in one column, or if codes have lost leading zeros, close it without saving changes and use Data > From Text/CSV instead. Importing is also preferable when you want to preserve a reusable query or deliberately control the destination. If you open a CSV and then save it as an Excel workbook, use the Excel Workbook format (.xlsx) to keep workbook features. Saving back to CSV instead keeps only a plain-text table and may discard workbook-specific content.

Common import problems and limits

When an import looks wrong, identify whether the issue is column splitting, character encoding or data conversion. These are separate problems and need different fixes. A wrong delimiter affects where fields divide; wrong encoding affects how characters display; automatic type detection affects how values are stored.

  • Everything appears in one column: Reopen the import preview and try the actual separator, such as comma, semicolon or tab.
  • Leading zeros disappear: Import the affected column as Text rather than allowing it to become a number.
  • Dates are reversed or unexpected: Confirm the source’s date convention and use an appropriate locale during transformation.
  • Symbols or letters look corrupted: Check the encoding or file origin, and confirm the source file’s encoding if possible.
  • Some rows do not line up: Look for inconsistent delimiters, line breaks inside quoted fields, or a file that is fixed-width rather than delimited.

There is also a worksheet size limit: a single Excel worksheet supports up to 1,048,576 rows and 16,384 columns. A text file exceeding those limits cannot fit in one worksheet in full. For a very large source, consider filtering or aggregating it before loading, or use a data tool designed to work with larger datasets. Importing is not a guarantee that every source file is well-formed; unusual quoting or inconsistent rows may need correction at the source or in the query.

Excel on Mac and Excel for the web

This guide’s menu path is for Excel for Microsoft 365 on Windows. Recent Excel for Mac versions also provide text and CSV import options on the Data tab, but the dialog and available controls can differ by version. If the Windows labels are not present, look for the text or CSV import command on the Mac Data tab and review the preview before loading. Keyboard shortcuts also differ between Windows and Mac, so the menu is the clearest route here.

Excel for the web can work with workbook files stored online, but the desktop app is the more dependable choice when you need detailed control of encoding, data types or Power Query transformations. If a web workflow does not show the import controls you need, open the workbook in the desktop version and use its Data tab. In all versions, check the resulting columns and representative values before relying on the imported table.

Frequently Asked Questions

How do I import a CSV file into Excel without losing leading zeros?
Use Data > From Text/CSV, choose Transform Data, and set the identifier column to Text before loading. Opening the CSV directly can allow Excel to convert values such as 00127 to 127.

Why does my CSV open in one column?
Excel may be using a delimiter that does not match the file. Import it through the Data tab and select the separator shown by the source, such as a semicolon or tab rather than a comma.

Can I import a TXT file into Excel?
Yes. Choose Data > From Text/CSV and select the TXT file. Review the preview and select the delimiter that matches its layout; a fixed-width file may require additional splitting or a compatible text-import option.

Will Excel keep formatting from a CSV file?
No. CSV stores plain text values, not Excel cell formatting, multiple sheets or charts. After importing, save the result as an .xlsx workbook if you need to retain Excel formatting and workbook features.

How can I update imported data after the source file changes?
If you imported it as a Power Query connection, keep the source file accessible and choose Data > Refresh All. If the source was moved or renamed, update the query’s source location first.

Related

Try it: the Date Difference Calculator: days, months, years and weekdays between two dates, with the DATEDIF formulas.

More in How-to basics

Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources

Spotted an error in this guide? Let us know.