How to Open a TXT File in Excel: Complete Step-by-Step Guide for Importing Text Files in 2026
Learn how to open a txt file in Excel using Text Import Wizard, Power Query, and direct methods. Step-by-step guide with delimiter tips and troubleshooting.

Learning how to open a txt file in Excel is one of the most underrated yet essential skills for anyone working with data, whether you are an analyst pulling logs from a server, an accountant importing bank statements, or a student practicing basic Excel operations. Text files (.txt) come in many formats, including tab-delimited, comma-separated, fixed-width, and space-separated variants, and each requires a slightly different approach to import cleanly. Excel provides three primary methods: direct opening, the legacy Text Import Wizard, and modern Power Query, each suited to different scenarios and data volumes.
The reason this skill matters more than it appears is simple: real-world data rarely arrives in a perfect Excel format. Government databases export CSV and TXT, point-of-sale systems dump tab-delimited logs, scientific instruments produce fixed-width readings, and legacy mainframe systems still push pipe-delimited files daily. If you cannot parse these files into clean columns inside Excel, you cannot analyze them, pivot them, or apply formulas like vlookup excel to merge them with other datasets. The text import workflow becomes your gateway to every downstream analysis.
Microsoft has evolved the text import experience significantly across Excel versions. In Excel 2003 and earlier, the Text Import Wizard launched automatically when you opened any .txt file. In Excel 2016 and later, Microsoft hid this wizard by default and pushed users toward Power Query via the Get & Transform Data ribbon. Excel 365 still allows access to the legacy wizard, but you must enable it manually in Options. Knowing which method to use for which version saves hours of frustration when handling unfamiliar files or training new team members.
This guide walks you through every method, including the often-overlooked tricks for handling tricky scenarios: files with mixed delimiters, leading zeros that disappear, dates that flip from US to European format, scientific notation overwriting long numbers, and UTF-8 encoded files with foreign characters. We will also show you how to automate repeated imports using Power Query refresh, so you never have to manually re-import the same monthly export again. By the end, opening any text file will feel as natural as opening a workbook.
Before we dive in, it helps to understand what a .txt file actually contains. Unlike .xlsx or .xls files, which store cells, formulas, and formatting in a binary or XML structure, a text file is pure plain text: every value is separated from the next by a delimiter character, and every row ends with a line break. Excel does not naturally understand this structure, so the import process is essentially telling Excel: here is where one column ends and another begins, here is what data type each column should be, and here is how to interpret special characters.
Whether you are importing a 50-row contact list or a 2-million-row transaction log, the principles remain the same. The difference lies in choosing the right tool: for small one-off files, the Text Import Wizard is fastest; for files you will refresh repeatedly, Power Query wins every time; for files that exceed Excel's 1,048,576-row limit, you need to use the Data Model or Power Pivot. Understanding these tradeoffs is the first step toward becoming a confident data importer in Excel.
Throughout this article, we reference real-world scenarios drawn from finance, marketing, IT, and academic research so you can see exactly which method maps to which problem. We also cover the exact keyboard shortcuts, ribbon paths, and dialog box options for both Windows and Mac versions of Excel, since the experience differs between platforms in subtle but important ways. Bookmark this guide as your go-to reference whenever a stubborn text file lands in your inbox.
Text File Import in Excel by the Numbers

Three Methods to Import a Text File
Method 1: Direct Open
Method 2: Text Import Wizard
Method 3: Power Query
Method 4: Copy-Paste with Text-to-Columns
Method 5: VBA Automation
Let's walk through the Text Import Wizard in detail, because despite being labeled legacy, it remains the fastest method for one-off imports under a few hundred thousand rows. To enable it in Excel 365, click File > Options > Data, then check the box labeled From Text (Legacy). Once enabled, the option appears under Data > Get Data > Legacy Wizards > From Text (Legacy). For Excel 2016 and earlier, the wizard launches automatically when you open a .txt file via File > Open.
Step 1 of the wizard asks whether your data is Delimited or Fixed Width. Delimited means columns are separated by a specific character (tab, comma, semicolon, etc.). Fixed Width means each column starts at a specific character position regardless of content. Choose Delimited for 95% of modern files; Fixed Width is mostly for legacy mainframe exports. The wizard also asks at which row to start importing, which is useful for skipping header banners or report titles that precede the actual data table.
Step 2 lets you pick the delimiter. Excel offers checkboxes for Tab, Semicolon, Comma, Space, and Other (where you can type a custom character like a pipe |). Watch the preview pane at the bottom: as you toggle delimiters, the data snaps into columns. If columns look wrong, try a different delimiter or check the box for Treat consecutive delimiters as one, which is critical for space-separated files where multiple spaces are used for alignment rather than as true separators between values.
Step 3 is the most important and most often skipped: setting column data types. By default, Excel imports every column as General, which sounds harmless but causes three notorious problems. Leading zeros disappear (00123 becomes 123), long numbers convert to scientific notation (1234567890123456 becomes 1.23E+15), and dates may flip between US and European interpretations (03/04/2026 might become March 4 or April 3 depending on regional settings). To avoid this, click each problem column and explicitly set it to Text or Date with the correct format.
For columns containing product codes, phone numbers, ZIP codes, or any identifier with leading zeros, always choose Text. For dates, select Date and then pick the correct order (MDY, DMY, YMD) matching the source file, not your regional preference. Excel will respect this conversion regardless of your local Windows date settings. After confirming the data types, click Finish, and Excel asks where to place the imported data: a new sheet, the current sheet at a specific cell, or a new workbook entirely.
One often-missed tip: if your text file has consistent structure that you import weekly or monthly, save the import as a connection rather than just data. The wizard's Properties button on the final step lets you toggle Save query definition, which means refreshing the data later automatically re-applies all your settings. This turns a manual ten-click process into a one-click refresh, similar to how you might apply a vlookup excel formula across refreshes without redefining it each time.
If you encounter encoding problems where foreign characters appear as boxes or question marks, check the File Origin dropdown at the very top of Step 1. Common options include Windows (ANSI), Unicode (UTF-16), and UTF-8. Most modern files are UTF-8, but legacy Windows files are ANSI, and Mac files may use MacRoman. Pick the wrong encoding and your รฉ becomes รยฉ, your รถ becomes รยถ, and your data analysis becomes a debugging nightmare. Always preview before clicking Next to confirm characters render correctly.
Common Delimiter Types and How to Handle Them
Tab-delimited files use the tab character (ASCII 9) to separate values. These are the cleanest text files because tabs rarely appear inside data values, so there is little risk of column misalignment. Most database exports, business intelligence tools, and statistical software like SPSS or SAS default to tab delimiters. When you open a .tsv file in Excel, the Text Import Wizard usually detects the tab automatically.
In the wizard Step 2, simply check the Tab box and uncheck all others. If your file has occasional empty cells, also enable Treat consecutive delimiters as one only if you confirm that empty values should collapse, otherwise leave it unchecked. The preview pane shows you exactly how the import will render before you commit. Tab-delimited remains the safest format for sharing structured data between disparate systems.

Text Import Wizard vs Power Query: Which Should You Use?
- +Power Query handles files over 1 million rows by loading directly to the Data Model
- +Power Query saves all transformation steps and refreshes with one click on monthly files
- +Power Query correctly handles RFC 4180 CSV quoting with commas inside quoted fields
- +Power Query supports UTF-8 encoding by default, avoiding character corruption
- +Power Query lets you filter, transform, and split columns before loading into Excel
- +Power Query connections work in Excel, Power BI, and Microsoft Fabric without rewriting
- โText Import Wizard is faster for one-off small files under 10,000 rows
- โWizard provides immediate visual feedback for data type selection
- โPower Query has a steeper learning curve for first-time users
- โWizard files load directly into a sheet with no separate connection to manage
- โPower Query refresh can be slow on very wide files with many columns
- โWizard works on older Excel versions that lack Power Query (pre-2016)
Pre-Import Checklist Before Opening Any TXT File
- โOpen the file in Notepad or VS Code first to identify the delimiter visually
- โCount rows quickly to decide whether you need Power Query for over a million rows
- โCheck for a header row and note its position to skip preamble lines
- โIdentify columns with leading zeros and plan to set them as Text type
- โLook for date columns and confirm format order (MDY, DMY, YMD)
- โVerify encoding by checking for foreign characters or unusual symbols
- โNote any quoted fields containing the delimiter character inside
- โConfirm line endings work (Windows CRLF vs Unix LF can cause issues)
- โDecide if data needs filtering, transformation, or splitting before loading
- โPlan where to place imported data: new sheet, current sheet, or data model
Power Query connections refresh automatically every time
If you import the same TXT file format weekly or monthly, set it up once in Power Query and save the connection. Each subsequent month, just replace the source file and click Refresh All. This eliminates 95% of repetitive import work and locks in your data type choices forever.
Power Query is Excel's most powerful text import engine, and once you learn it, you will rarely go back to the Text Import Wizard for anything beyond trivial files. To launch it, go to Data > Get Data > From File > From Text/CSV, then navigate to your .txt file. Excel previews the first 200 rows in a dialog, automatically detecting the delimiter and file encoding. Click Transform Data to open the full Power Query Editor, or click Load to import directly with the detected settings.
Inside the Power Query Editor, you see your data in a grid with a Query Settings pane on the right and a ribbon at the top. The ribbon has tabs for Home, Transform, Add Column, and View, each offering dozens of operations. The most important pane is Applied Steps in the lower right, which records every action you take. If you change your mind, click any step to revert the data to that state, or click the X next to a step to delete it entirely. This non-destructive workflow is Power Query's greatest strength.
For text file imports, the first three applied steps are usually Source (load the file), Promote Headers (use the first row as column names), and Changed Type (auto-detect data types). The Changed Type step is where most import problems originate, because Power Query guesses types from the first 200 rows. If row 50,000 contains a value Power Query did not expect, the import fails with an error. To prevent this, delete the Changed Type step and manually set types after filtering or cleaning the data, or sample more rows via the data type detection settings.
One of Power Query's killer features is automatic refresh. After loading data to a sheet, right-click the resulting table and choose Refresh. Power Query re-reads the source file and re-applies every transformation step. If you place the .txt in a fixed folder and name it consistently (like sales_latest.txt), monthly updates become a one-click operation. You can even schedule refreshes via Power Automate or VBA for fully automated reporting pipelines that update overnight.
Power Query also handles errors gracefully. If a row has too many or too few columns, you can route those rows to a separate error table for review rather than failing the entire import. The Remove Errors and Keep Errors buttons on the Home tab make this trivial. Combined with the Replace Errors function, you can substitute null or default values for problematic cells, ensuring your downstream analysis (such as a vlookup excel formula) never breaks because of one malformed line in a 100,000-row file.
For files larger than Excel's 1,048,576 row limit, Power Query supports loading directly to the Data Model rather than a worksheet. In the Load dialog, choose Only Create Connection and check Add this data to the Data Model. The data is now available for Power Pivot calculations, PivotTables, and DAX measures without ever materializing in a sheet. This technique lets you analyze hundreds of millions of rows of text data inside Excel, something the legacy wizard could never do.
Power Query queries can be chained, merged, and parameterized. You can import three text files, transform each, and join them on a common key before loading. You can extract values from text columns using built-in M language functions like Text.Split, Text.BetweenDelimiters, and Text.Replace. For repetitive monthly imports, parameterize the file path so updating the source is a single click. Mastering Power Query transforms your relationship with text files from manual chore to automated pipeline.

If your TXT file contains long numbers like credit card IDs, IMEI codes, or 16-digit account numbers, Excel automatically converts them to scientific notation (1.23E+15) and permanently loses the last digits. Always set such columns to Text before clicking Finish, or you lose data integrity beyond recovery.
Even seasoned Excel users run into stubborn text import problems. The most common is the dreaded scientific notation conversion: a column of long account numbers or product codes becomes useless after import because Excel rounded the last digits. The fix is always proactive, never reactive: set the column type to Text in Step 3 of the wizard or in Power Query before loading. Once Excel has rounded a number to 15-digit precision, the original digits are gone forever and no formula can recover them.
Another classic issue is the date flip. A US user importing a European file sees 03/04/2026 as March 4 when it should be April 3. To fix this, explicitly choose the date format in the wizard or use Power Query's Locale option when changing column type. In Power Query, right-click the date column header, choose Change Type > Using Locale, and select the source country. This converts dates correctly regardless of your computer's regional settings, which is invaluable for global teams sharing files across timezones.
Encoding problems show up as garbled characters: รฉ becomes รยฉ, รถ becomes รยถ, and Chinese characters become rows of question marks. This happens when the file is UTF-8 but Excel reads it as ANSI, or vice versa. In Power Query, click the gear icon next to the Source step and try different File Origin options until characters render correctly. The most common encodings to try are 65001 (UTF-8), 1252 (Western European), and 1200 (UTF-16 LE). Saving the file as UTF-8 with BOM eliminates ambiguity for future imports.
Truncated files are another headache. If your TXT contains more than 1,048,576 rows, Excel silently drops everything beyond that limit when loading to a sheet. The status bar shows a warning, but it is easy to miss. The solution is to load to the Data Model via Power Query, where billions of rows are supported. Alternatively, split the file using PowerShell or a Python script before import, then concatenate the pieces in Power Query using the Combine Files feature.
Multi-character delimiters cause headaches because the legacy Text Import Wizard supports only single-character delimiters in its standard checkboxes. If your file uses ||, !#!, or another multi-char separator, use Power Query and pass the exact delimiter string in the dialog. Alternatively, open the file in Notepad++, do a find-and-replace to swap the multi-char delimiter for a single tab, and import the modified file. Save the original first so you never lose source integrity.
Leading and trailing whitespace is invisible but breaks lookups. After import, a value of John Smith with a trailing space will not match John Smith in another sheet, causing vlookup excel formulas to return N/A. Always run Power Query's Trim function on text columns before loading, or apply TRIM() and CLEAN() functions in Excel itself. CLEAN() removes non-printing characters like line feeds embedded inside cells, which can sneak in from copy-pasted source documents and silently corrupt joins.
Finally, watch for line ending differences between operating systems. Windows uses CRLF, Mac and Linux use LF, and very old Mac files use CR alone. Excel handles all three, but mixed line endings inside the same file (common when files pass through multiple systems) can cause rows to merge or split incorrectly. If you suspect this, open the file in a programmer's editor like VS Code, set the line ending to LF or CRLF consistently, save, and re-import. Cleanup at the source is always faster than debugging downstream.
Beyond the mechanics of importing, there are practical workflow tips that distinguish casual Excel users from data professionals. The first is to standardize your incoming text file folder structure. Create a dedicated folder for raw imports, never overwrite originals, and use date-stamped filenames like sales_2026_05_21.txt. This habit alone prevents 80% of accidental data loss and makes it trivial to roll back to a previous version when an import goes wrong or a colleague asks about historical data.
The second tip is to document your import settings. Whenever you set up a Power Query import, add a comment to the Applied Steps explaining why each transformation exists. Future you (or a coworker inheriting the file) will thank you when trying to understand why a column was filtered or a particular value was replaced. Power Query lets you rename steps to descriptive labels like FilterOutTestRecords or NormalizeDateFormat, which serves as inline documentation that survives version updates.
The third tip is to validate every import. After loading data, run a quick sanity check: row count matches expected (use COUNTA in a sheet or Number of Rows in Power Query), column count matches expected, sum of a key numeric column matches the source total, and no critical column contains nulls where data was expected. These four checks take under a minute and catch 95% of import errors before they propagate into analysis or reporting. Build them into a template you reuse.
The fourth tip applies to recurring imports: parameterize the source path. In Power Query, create a parameter named SourceFile, point your query at the parameter instead of a hardcoded path, and update the parameter monthly. This single change turns a one-month-old query into a perpetual pipeline. You can also store parameters in a worksheet table for users who do not know Power Query, letting them update the file path without touching the M code at all.
The fifth tip is to leverage the Excel community. Every text file challenge you face has been solved before by someone on Stack Overflow, MrExcel, or Microsoft Tech Community. Search for the exact error message or transformation you need, and you will usually find working M code, VBA snippets, or wizard tips within minutes. Bookmark a few high-quality forums and treat them as extensions of Excel's built-in help. The hours saved compound over a career.
The sixth tip is to keep practicing. Excel's text import features evolve with each release: Office 365 introduces new connectors quarterly, and Power Query receives major updates twice a year. Try a free practice quiz on basic and advanced Excel topics to confirm your fundamentals are sharp. Then explore newer features like the Data Types gallery, which can enrich imported text data with stock prices, geographic info, or Wikipedia metadata automatically through Excel's online services.
The seventh and final tip: never trust a text file blindly. Always preview, validate, and spot-check. Even files from trusted sources contain typos, encoding errors, missing rows, and unexpected delimiter characters. A thirty-second preview saves a thirty-minute debugging session later. Build the habit of treating every text file as a potential trap, and your data quality will skyrocket. Combine that mindset with the technical methods covered in this guide, and opening any .txt file in Excel becomes a smooth, predictable, repeatable process.
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.