How to Convert TXT to Excel: Complete Step-by-Step Guide for 2026
Learn how to convert txt to excel using Import Wizard, Power Query, and VBA. Step-by-step guide with tips for clean, structured data every time.

Knowing how to convert TXT to Excel is one of the most practical skills any data professional, analyst, or office worker can develop. Whether you are pulling in sales records from a legacy system, importing log files from a server, or working with comma-separated exports from accounting software, raw text files are everywhere.
Excel gives you multiple reliable pathways to bring those flat files into a structured spreadsheet where you can sort, filter, analyze, and visualize the data with ease. For deeper financial analysis once your data is clean, check out our guide on how to convert txt to excel and connect it to powerful finance models.
Text files typically come in two flavors: delimited files, where columns are separated by a character like a comma, tab, semicolon, or pipe, and fixed-width files, where each column occupies a set number of characters. Excel handles both formats gracefully once you know which tool to reach for. The built-in Text Import Wizard has been a staple since Excel 2003, while Power Query — introduced in Excel 2010 and now native in Microsoft 365 — provides a more robust and repeatable import pipeline that refreshes automatically when your source file updates.
Many users also encounter TXT files that are not purely delimited. Real-world data is messy: fields may contain the delimiter character inside quoted strings, encoding may be UTF-8 or Windows-1252, and numeric formats may use European decimal commas instead of periods. Understanding these edge cases before you import saves hours of cleanup downstream. Excel's import tools expose controls for all of these situations, and this guide walks through every option in plain language so you can handle any file structure you encounter.
The skill also connects to adjacent Excel capabilities worth knowing. Once your data lands in a worksheet, you will likely use VLOOKUP or its modern replacement XLOOKUP to join it against reference tables. You may freeze the header row so column labels stay visible while you scroll through thousands of records. You might create a drop-down list in Excel to standardize categorical fields that arrived as free text. Each of these follow-on tasks flows directly from a clean import, which is why getting the conversion step right matters so much in practice.
Performance is another consideration that separates a good import from a great one. A naive copy-paste of a 200,000-row text file into Excel can freeze the application for minutes, corrupt date formats, and silently drop leading zeros from ZIP codes and product codes. The structured import methods described in this article prevent all of those problems because they let you pre-specify data types column by column before a single row loads into memory. That extra minute of setup at import time eliminates the data-type firefighting that otherwise consumes entire afternoons.
Throughout this guide you will find concrete examples with real file layouts, numbered steps you can follow on your own machine, and notes on the most common mistakes beginners make at each stage. By the end, you will be able to import any well-formed text file in under five minutes and handle most malformed files with only a few extra steps. Whether you are preparing for an Excel certification exam or simply trying to get your job done faster, mastering the TXT-to-Excel conversion workflow is an investment that pays dividends every single week.
TXT to Excel Conversion: Key Numbers

Three Methods to Convert TXT to Excel
Method 1: Open Directly in Excel
Method 2: Text Import Wizard via Data Tab
Method 3: Power Query (Get & Transform)
Method 4: VBA Macro Automation
Method 5: Copy-Paste with Text to Columns
The Text Import Wizard remains the most widely used method for converting TXT to Excel because it works in every version of Excel from 2003 through Microsoft 365 and requires no add-ins or advanced knowledge. When you open a .txt or .csv file through Excel's File > Open dialog, the wizard launches automatically, presenting a three-step interface that walks you through every key decision. Step 1 asks whether your data is delimited or fixed-width, and this is the most critical choice you will make in the entire workflow — getting it wrong means misaligned columns in every row.
For delimited files, Step 2 lets you choose one or more delimiter characters simultaneously. If your file uses tabs, check Tab. If it uses commas, check Comma. You can even enter a custom single character — useful for pipe-delimited exports from enterprise systems. The live preview at the bottom of the dialog updates instantly as you toggle options, so you can visually confirm columns are splitting correctly before committing.
Pay special attention to the Treat consecutive delimiters as one checkbox: leave it unchecked unless your file genuinely uses multiple delimiters to represent a single separator, or you will accidentally collapse real empty fields and shift all subsequent columns left.
Fixed-width files require a different approach in Step 2. Excel displays a character ruler above the preview and lets you click to set column break lines. If your file's documentation specifies field widths — for example, Name occupies positions 1–30, Amount occupies positions 31–42 — set your breaks at those exact positions. You can drag existing break lines to reposition them and double-click any break line to delete it. This manual step is slower than delimiter detection, but it is perfectly accurate when your source file was generated by a system that pads all fields to a fixed width.
Step 3 is where many users make costly mistakes by skipping past it too quickly. The Column data format section lets you assign a data type to each column individually. The three options are General (Excel guesses), Text, and Date with a format picker. Always set any column containing leading zeros — ZIP codes, employee IDs, product SKUs — to Text before importing.
If you leave it on General, Excel will strip the leading zero from 07030 and store it as the number 7030, a change that cannot be undone by formatting after the fact. Similarly, set date columns to Date and specify the order of day, month, and year that your file uses, because an ambiguous date like 04/05/2024 will be read as April 5 in a US locale but May 4 in a European locale.
After completing all three wizard steps and clicking Finish, Excel asks where to place the imported data: in the existing worksheet starting at a specific cell, or in a new worksheet. For large imports, choose a new worksheet to keep your source data isolated from any existing content. Once the data lands in cells, immediately save the file as an .xlsx workbook — Excel will warn you that saving as the original .txt format would discard formatting, which is exactly the behavior you want to avoid. Saving as .xlsx locks in all the data types you specified in Step 3.
One advanced wizard technique worth knowing is skipping columns during import. In Step 3, click any column in the preview and choose Do Not Import Column (Skip) from the Column data format options. This is particularly valuable when working with wide log files that contain 40 or 50 columns but you only care about 5 or 6. Skipping unwanted columns at import time rather than deleting them post-import keeps your workbook lighter and your import faster, especially for files with hundreds of thousands of rows.
Finally, remember that the Text Import Wizard is a one-time snapshot: it copies the data from the TXT file into Excel at import time and severs the connection. If the source file is updated tomorrow, you must re-run the import manually. If you need a live connection that refreshes on demand, Power Query is the right tool. But for the vast majority of one-time data-loading tasks — pulling in a monthly report, importing a client's data extract, loading a configuration file — the Text Import Wizard is fast, reliable, and available on every Excel installation without any setup.
Power Query vs Text Wizard vs VBA: Which Method to Use
Power Query, accessed via Data > Get Data > From File > From Text/CSV, is the best choice when your TXT file is updated regularly. After the initial setup, you simply click Data > Refresh All and your worksheet reflects the latest version of the source file in seconds. Power Query also handles encoding detection automatically, merges cells intelligently, and lets you apply transformation steps — trimming whitespace, splitting columns, filtering rows — that are saved and reapplied on every refresh without any manual intervention.
The Query Editor interface shows each transformation as a numbered step in the Applied Steps panel on the right. You can reorder, delete, or edit any step at any time, making your import process fully auditable and easy to modify when the source file format changes. Power Query is especially powerful when combined with VLOOKUP Excel formulas downstream, because clean, consistently typed data produces reliable lookup results. It integrates naturally with how to create a drop down list in Excel for validated data entry workflows, turning a raw text import into a production-ready data pipeline.

TXT Import vs Direct Excel Entry: Advantages and Limitations
- +Preserves exact source data without manual re-entry errors
- +Handles hundreds of thousands of rows that would take days to type manually
- +Power Query creates a live connection that refreshes with one click when source data updates
- +Data type assignment at import prevents leading-zero loss and date misinterpretation
- +Encoding selection supports international character sets including UTF-8 and Latin-1
- +Fixed-width parsing correctly splits fields that have no delimiter character
- −Malformed TXT files with inconsistent delimiters require manual pre-processing before import
- −The Text Import Wizard creates a static snapshot with no auto-refresh capability
- −Files encoded in rare or legacy code pages may display garbled characters if encoding is misidentified
- −Very large files over 500MB can cause Excel to become unresponsive during import
- −Quoted fields containing embedded newlines may not parse correctly in all Excel versions
- −Fixed-width column breaks must be set manually and are not saved for future imports
TXT to Excel Import Checklist: 10 Steps for Clean Data
- ✓Open the TXT file in a text editor first to confirm the delimiter character and encoding before importing.
- ✓Check for quoted fields that contain the delimiter character — these need the Text Qualifier option set to double-quote.
- ✓Set any column with leading zeros (ZIP codes, IDs) to Text format in the wizard's Step 3 before clicking Finish.
- ✓Specify the correct date order (MDY, DMY, or YMD) for every date column to prevent date transposition errors.
- ✓Turn off the Treat consecutive delimiters as one option unless your file uses repeated delimiters as whitespace padding.
- ✓Select UTF-8 encoding in the File Origin dropdown if your data includes accented characters or non-Latin scripts.
- ✓Use Power Query instead of the wizard if the source file will be updated and you need auto-refresh capability.
- ✓Save the imported file immediately as .xlsx to lock in data types and prevent Excel from re-parsing on next open.
- ✓Verify the row count in Excel matches the line count in the original TXT file to confirm no rows were dropped.
- ✓Apply how to freeze a row in Excel to pin the header row so column labels remain visible while scrolling large datasets.
Always Set ID and ZIP Code Columns to Text Before Importing
The single most common and irreversible import mistake is allowing Excel to auto-detect numeric columns that contain leading zeros. Once Excel strips the leading zero and stores the value as a number, you cannot recover the original string by applying a custom format — the zero is gone from the cell value itself. Always pre-assign these columns to Text in Step 3 of the Import Wizard, or apply a Text transformation step in Power Query, before the data ever touches a cell.
Even experienced Excel users run into errors when converting TXT files, and understanding the root causes makes troubleshooting much faster. The most common problem is garbled or missing characters, which almost always means an encoding mismatch.
Text files generated on Windows default to Windows-1252 encoding, while files produced on Linux or Mac systems or by modern web services typically use UTF-8. If you open a Windows-1252 file while Excel's File Origin setting is pointed at UTF-8, accented characters like é, ü, and ñ will appear as sequences of symbols like ’ or similar garbage. Fix it by re-running the import and selecting the correct encoding from the File Origin dropdown in Step 1 of the wizard.
The second most common error is column misalignment, where data that should appear in column C ends up in column B or D for certain rows. This usually means the file is not consistently delimited — some rows use a tab while others use spaces, or quoted fields contain an unescaped delimiter character.
Open the file in a plain-text editor that shows invisible characters (Notepad++ with View > Show All Characters is excellent for this) and look for rows where the delimiter pattern differs. You may need to find-and-replace inconsistent delimiters before importing, or use Power Query's robust quoted-field handling, which correctly ignores delimiters inside quotation marks.
Date conversion errors are the third major category of import problems. When a date column lands in Excel as a text string — you can tell because the dates left-align rather than right-align and =DATEVALUE() on them returns an error — it means Excel did not recognize the date format during import. Return to the wizard, click the date column in the Step 3 preview, select Date, and then choose the correct format code from the dropdown.
If your file has dates in YYYY-MM-DD ISO format, choose YMD. If it has DD/MM/YYYY European format, choose DMY. After re-importing with the correct date type, the dates will right-align, confirm they are stored as Excel date serial numbers, and work correctly with all date functions.
Number format errors, particularly with decimals, affect files sourced from European locales where a comma serves as the decimal separator. Excel in a US locale reads 1,234 as the number one thousand two hundred thirty-four rather than one point two three four.
Power Query handles this gracefully with its locale-aware type conversion: right-click a column header, choose Change Type > Using Locale, and select the source file's locale. The Text Import Wizard does not have this feature, so European decimal files imported via the wizard require a post-import find-and-replace that swaps the decimal comma for a period, followed by converting the Text column to Number.
Memory errors and slow performance when importing very large TXT files usually come from loading unnecessary columns. If your file has 60 columns but your analysis needs only 8, skip the other 52 columns during import. In the wizard, select each unwanted column in the Step 3 preview and click Do Not Import Column. In Power Query, use Choose Columns to remove them in the first transformation step before the data expands into memory. Reducing a 60-column import to 8 columns can cut memory usage by over 85 percent and speed the import by a similar factor.
A subtler problem involves numeric precision loss when importing large integers or high-precision decimals. Excel's native number format is a 64-bit IEEE 754 floating-point value with about 15 significant digits. A 16-digit number like a bank account number or product serial number will lose its last digit to rounding unless the column is imported as Text. The General auto-detect setting will silently convert 1234567890123456 to 1234567890123460 — a difference that is invisible in normal display but devastating in any lookup or comparison operation. Always import long numeric identifiers as Text, not General or Number.
Finally, line-ending inconsistencies can cause single-row imports where the entire file appears in one cell. This happens when a Unix-format file with LF-only line endings is opened in an older Excel version that expects Windows-style CRLF line endings.
The fix is to convert the file's line endings before importing: open the file in Notepad++, navigate to Edit > EOL Conversion > Windows Format, save, and then import into Excel. Modern Microsoft 365 versions handle both LF and CRLF correctly, so this issue is increasingly rare but still surfaces when working with files generated by older Linux scripts or macOS shell utilities.

After converting your TXT file to Excel, always save the workbook as .xlsx or .xlsb. If you accidentally save back to .txt format, Excel will strip all formatting, data validation, formulas, and multiple worksheets — keeping only the raw values from the active sheet. This action is not undoable after the file is closed. Excel warns you with a dialog, but it is easy to click through without reading it, so make saving as .xlsx your immediate first step after every import.
Advanced users can significantly extend Excel's TXT import capabilities through Power Query's transformation layer, which sits between the raw file and the worksheet and processes data without ever writing intermediate files.
One of the most powerful transformation patterns is conditional column creation: after importing a text file that contains a Status field with values like ACTIVE, INACTIVE, and SUSPENDED as plain strings, you can add a custom column in Power Query that maps those strings to descriptive labels or numeric codes using an if-then-else expression. This transformation runs before the data reaches the worksheet, keeping your worksheet formulas simpler and your data model cleaner.
Power Query's Split Column feature handles complex multi-value fields that are common in log files and CSV exports from web applications. A single column might contain a value like John Smith|john@example.com|555-0100 where a pipe character separates three different pieces of information.
In Power Query, right-click the column header, choose Split Column > By Delimiter, enter the pipe character, and select Each occurrence of the delimiter. Power Query creates three new columns automatically, named with the original column name plus a numeric suffix. You can then rename each column and assign appropriate data types — Text for name and email, Text for the phone number to preserve any formatting.
The Unpivot feature in Power Query solves a different structural problem that commonly appears in TXT exports from spreadsheet-based systems. If your text file has month names as column headers — Jan, Feb, Mar through Dec — and sales figures in each cell, that is a wide format that is difficult to analyze with pivot tables and VLOOKUP Excel functions.
In Power Query, select the non-month identifier columns, right-click, and choose Unpivot Other Columns. Power Query transforms the wide table into a tall table with three columns: the identifier, a Month column, and a Value column. This normalized structure works with every Excel analysis tool and is far easier to maintain as new months are added.
For organizations that receive the same TXT file layout every week or month, saving the Power Query steps as a connection is only half the automation story.
You can take it further by storing the file path in a named cell on a settings worksheet and referencing that cell in your Power Query source step using the formula = Excel.CurrentWorkbook(){[Name="FilePath"]}[Content]{0}[Column1]. Now any team member can update the file path by editing one cell, and the query picks up the new location on the next refresh without anyone touching the query definition. This pattern is especially useful when files arrive with date-stamped filenames like sales_2026_05.txt and the path changes monthly.
Combining TXT import with Excel's inner excellence in data validation creates a powerful data quality gate. After importing, add a new column with a formula that flags rows where mandatory fields are blank, date values fall outside expected ranges, or numeric values exceed business-rule thresholds. Use conditional formatting to highlight the flagged rows in red so data quality issues are visible at a glance. This validation layer turns a passive import step into an active data quality check that catches upstream problems before they propagate into reports and dashboards.
The VLOOKUP Excel function and its successor XLOOKUP become dramatically more useful when your import workflow is solid. Once you can reliably bring TXT data into Excel with correct data types, you can join it against master reference tables — product catalogs, customer records, cost centers — using lookup functions.
The join works correctly only when the key column types match exactly: if the TXT file's product code landed as Text and your reference table stores product codes as numbers, the lookup will return N/A for every row. Consistent data typing from the import step is what makes downstream lookups reliable.
For users preparing for Excel certification exams, understanding the full TXT import pipeline — from file structure recognition through encoding selection, delimiter detection, column type assignment, and Power Query transformation — covers a significant portion of the data management competency domain.
Practice importing files with intentional problems: a file with inconsistent delimiters, a date column in DMY format, a column of ZIP codes that must retain leading zeros. Working through these scenarios builds the muscle memory that exam questions test and that daily work demands. Use the quiz resources throughout this article to check your knowledge of import-related Excel features before your exam date.
Building good TXT import habits early saves enormous amounts of time over the course of a career. The single most impactful habit is documenting your import settings for every recurring file. Create a simple table on a hidden worksheet that records the file name pattern, delimiter, encoding, and the data type assigned to each column. When the file format changes six months from now — and it will — you have a baseline to compare against and you know exactly which settings need updating. This documentation takes five minutes to write and can save hours of rediagnosis when things break.
A second high-value habit is always validating your import with three checks before doing any analysis. First, count the rows in Excel and compare to the line count in the original file (subtract one for the header row). Use =COUNTA(A:A)-1 for a quick count. Second, spot-check five to ten rows by opening the TXT file in a text editor and confirming that the same values appear in the same positions in Excel.
Third, run =ISNUMBER() on a sample of each column that should contain numbers and =ISTEXT() on each column that should contain text, verifying that data types are what you intended. These three checks take under two minutes and catch the vast majority of import errors.
For teams that regularly import the same file types, investing in a Power Query template workbook pays off quickly. Set up the query once, configure all transformations, and save the workbook as a template. Team members open the template, update the file path in the settings cell, click Refresh All, and their import is done with the same settings every time. This approach eliminates the risk of one team member importing a comma-delimited file with semicolon settings and producing subtly wrong data that no one notices until a report goes to a client.
Learning how to merge cells in Excel is a related skill that often comes into play after import. Some TXT files export summary headers that span multiple columns, and when you import them, the header text lands in one cell while the adjacent cells are blank. Rather than merging cells — which breaks sorting and filtering — use Center Across Selection: select the relevant cells, press Ctrl+1, go to Alignment, and choose Center Across Selection from the Horizontal dropdown. This achieves the same visual effect as merging without the functional drawbacks, keeping your imported data fully sortable and filterable.
How to freeze a row in Excel is another technique that becomes essential once your TXT import lands thousands of rows in a worksheet. Navigate to the row below your header row, click View > Freeze Panes > Freeze Panes. Now when you scroll down to row 50,000 to verify a value, your header row stays fixed at the top and you always know which column you are looking at.
Combined with the practice of importing column type settings correctly so that headers are clearly distinguished from data rows, frozen panes make large imported datasets manageable without any additional organization overhead.
The connection between TXT import skills and broader Excel proficiency is direct and compounding. Every data analysis workflow in Excel starts with data in cells, and for most professionals that data arrives as a flat file rather than being typed manually.
The analyst who can import any TXT file reliably, with correct data types and no data loss, is ready to apply every other Excel skill — pivot tables, vlookup excel lookups, charts, conditional formatting, and financial modeling — immediately on arrival of each new data file. That import readiness is what separates a competent Excel user from an expert one in daily professional practice.
Excellence in Excel data management, much like the pursuit of excellence in any specialized field, comes from deliberate practice on real problems rather than from memorizing procedures in the abstract. The next time a colleague sends you a .txt file and asks you to analyze it, treat it as an opportunity to practice the full import workflow: examine the file structure, choose the right import method, assign all data types explicitly, validate the result, and document your settings.
Each repetition deepens the intuition that eventually makes these decisions automatic, turning a potentially frustrating task into a reliable, repeatable skill you can execute confidently under deadline pressure.
Excel Questions and Answers
About the Author
Business Consultant & Professional Certification Advisor
Wharton School, University of PennsylvaniaKatherine Lee earned her MBA from the Wharton School at the University of Pennsylvania and holds CPA, PHR, and PMP certifications. With a background spanning corporate finance, human resources, and project management, she has coached professionals preparing for CPA, CMA, PHR/SPHR, PMP, and financial services licensing exams.




