How to Convert Text to Excel: The Complete 2026 Guide to Importing TXT and CSV Files Into Spreadsheets
Learn how do i convert text file to excel with step-by-step methods for TXT, CSV, and delimited data using Power Query, Text Import Wizard, and formulas.

If you have ever asked yourself how do i convert text file to excel without losing formatting, scrambling columns, or breaking dates, you are not alone. Millions of analysts, accountants, students, and small business owners deal with raw .txt and .csv exports every week, and Excel remains the fastest tool to clean, sort, and analyze that data once it is properly imported. This 2026 guide walks you through every reliable conversion method, from the classic Text Import Wizard to the modern Power Query engine that ships with Microsoft 365.
Converting text to Excel sounds simple until you open a file and discover that everything landed in column A, leading zeros disappeared from ZIP codes, or dates flipped from MM/DD/YYYY to DD/MM/YYYY. The right approach depends on the structure of your source file, the version of Excel you are running, and what you plan to do with the data afterward. We will cover delimited files, fixed-width files, multi-line records, and even messy logs that combine tabs, pipes, and inconsistent spacing.
Excel offers at least five distinct ways to ingest text data, and choosing the wrong one can cost you hours of rework. Power Query is the modern default for repeatable, refreshable imports. The legacy Text Import Wizard still wins for one-off jobs where you want manual control over each column. Drag-and-drop opens a file instantly but applies aggressive auto-formatting. Copy-paste with Text-to-Columns is best for snippets from emails or PDFs. VBA macros automate everything when you process the same file format daily.
Throughout this guide we will reference real examples: a sales export with European decimal commas, a server log with timestamps and IP addresses, a fixed-width banking statement, and a tab-delimited inventory file with embedded quotes. By the end you will know exactly which method to reach for, how to preserve data types, and how to build an import that survives next month when the source file inevitably changes shape.
Microsoft has steadily pushed Power Query as the recommended path since Excel 2016, and in 2026 it remains the most powerful and most underused feature in the entire application. Once you record a query, you can refresh it with a single click whenever the source file updates, eliminating the manual import ritual entirely. That single shift saves the average finance analyst between two and four hours per week according to recent productivity surveys.
Before you start, gather three pieces of information about your source file: the delimiter (comma, tab, semicolon, pipe, or fixed width), the character encoding (UTF-8, ANSI, or UTF-16), and the locale used for dates and numbers. Having these answers ready turns a frustrating import into a thirty-second task. If you are still building core skills around lookups and references, the Excel Functions List is the fastest way to fill in gaps after your data lands in the sheet.
Whether you are migrating a legacy system, cleaning survey results, or just trying to open a CSV that someone emailed you, the techniques in this guide will work in Excel 2016, 2019, 2021, 2024, and Microsoft 365. Each section includes the exact menu path, common error messages, and a fallback plan when the first method fails. Let us get started with the fundamentals every conversion shares.
Text to Excel Conversion by the Numbers

Five Methods to Import Text Files Into Excel
Open Directly From File Menu
Drag and Drop Onto Excel
Data Tab Get Data From Text
Copy Paste With Text to Columns
VBA Macro or Office Script
Power Query is the gold standard for converting text to Excel in 2026, and it deserves its own deep walkthrough. Start by clicking the Data tab on the ribbon, then choose Get Data > From File > From Text/CSV. Browse to your source file and click Import. Excel scans the first 200 rows and presents a preview window showing the detected delimiter, file origin (encoding), and data type inference for each column. If the preview looks correct, click Load. If anything looks off, click Transform Data to open the Power Query Editor where you have full control.
Inside the Power Query Editor, every column has a small icon to the left of its header indicating the inferred type: ABC for text, 123 for whole numbers, 1.2 for decimals, a calendar for dates, and a globe for any/mixed type. Click the icon to override the type. This is where you fix common problems like ZIP codes losing leading zeros or product SKUs being converted to scientific notation. Always set ID-like columns to Text before any other transformation step.
The Applied Steps panel on the right records every action you take, from Source to Promoted Headers to Changed Type to Removed Columns. Each step is editable and reorderable, and the entire query is saved as a refreshable connection in the workbook. When the source file updates next week, you click Refresh All on the Data tab and every cleaning step replays automatically. This single feature transforms text conversion from a chore into a one-click operation.
Common Power Query transformations include splitting columns by delimiter, merging columns with a separator, replacing values, removing rows with errors, filling down blank cells, unpivoting wide tables into long format, and grouping by category to summarize. Each is a single click in the ribbon with no formula syntax required. For finance teams working with messy bank exports, these tools eliminate hours of manual cleanup every month, and our Excel Finance Functions Guide covers what to do once your data is clean.
One advanced trick: combine multiple text files from a folder into a single query. Use Get Data > From File > From Folder and point Excel at a directory containing dozens of similarly structured CSVs. Power Query treats every file as one row in a master list, then lets you click a combine button to append them all into a single table. New files dropped into the folder appear automatically on the next refresh, making this the ultimate solution for daily exports from a CRM, POS, or accounting system.
If you receive files via email, you can even point Power Query at a SharePoint folder or OneDrive sync location so refreshes pick up the latest version without manual download. Combined with Power Automate, the entire pipeline runs unattended on a schedule. The investment in learning Power Query repays itself within the first week for anyone who imports text data more than once a month.
Finally, remember that Power Query loads results either as a worksheet table, a connection only for use in pivot tables and Data Model, or both. The Load To dialog appears when you click the arrow next to Load on the home tab. Choose connection-only when working with tables over 500,000 rows to avoid bloating your workbook file size, and use the Excel Data Model for cross-table relationships and DAX measures.
Delimiters, Encoding, and Locale Settings for VLOOKUP Excel Imports
A delimiter is the character that separates one field from the next inside a text file. The four most common delimiters are comma (CSV), tab (TSV), semicolon (used in European locales where comma is the decimal separator), and pipe (popular for data with embedded commas). Excel auto-detects most delimiters, but you can override the choice in the Power Query preview or the Text Import Wizard step two screen.
When your data contains the delimiter inside a value, the field must be wrapped in double quotes. For example, the line 1,\"Smith, John\",42 has three fields: 1, Smith, John, and 42. Power Query handles quoted delimiters automatically. Legacy methods sometimes split the quoted field by mistake. If you see extra columns appearing after import, inspect the source for unquoted commas inside text values like company names or addresses.

Power Query Versus Legacy Text Import Wizard: Which Should You Use
- +Power Query queries are refreshable with one click when the source file updates
- +Each transformation step is recorded, editable, and reorderable for full auditability
- +Locale-aware date and number parsing prevents silent corruption on international data
- +Combine multiple files from a folder into a single appended table automatically
- +Type detection handles leading zeros, scientific notation, and mixed columns gracefully
- +Output integrates directly with pivot tables, Data Model, and Power BI for reporting
- +Works identically across Excel 2016, 2019, 2021, 2024, and Microsoft 365 versions
- −Initial learning curve is steeper than the simple three-step Text Import Wizard
- −Very large workbooks with many queries can become slow to open and refresh
- −Some older Excel versions hide Power Query behind a separate add-in installation
- −Refresh failures appear as cryptic error messages that require query editor inspection
- −Queries can be accidentally broken when source file column order changes
- −Sharing workbooks with external users sometimes triggers privacy and data source prompts
Pre-Import Checklist: Convert Text to Excel Without Errors
- ✓Open the source file in Notepad or VS Code to confirm the delimiter and inspect line endings
- ✓Verify the character encoding is UTF-8, ANSI, or UTF-16 before launching the import
- ✓Note the source locale for any date and decimal columns to avoid silent number flips
- ✓Identify ID, ZIP, phone, and SKU columns that must be imported as text to preserve leading zeros
- ✓Confirm row count is under 1,048,576 or plan to load directly to the Data Model instead
- ✓Check for embedded line breaks inside quoted fields that could split a single record into many
- ✓Decide whether the import is one-time or repeating to choose between paste and Power Query
- ✓Create a backup copy of the original text file before any cleanup or transformation
- ✓Close other workbooks with similar names to avoid accidental cross-references in formulas
- ✓Have the destination workbook open and saved before starting a large data load
Always Set ID Columns to Text Before Any Other Step
When Power Query detects a column as Whole Number, it strips leading zeros and converts long strings to scientific notation. A ZIP code like 02134 becomes 2134, and a SKU like 1234567890123 becomes 1.23E+12. Change the type to Text as the very first step after Promoted Headers. This single habit prevents 80% of data quality complaints from downstream users.
Even with the best method, text imports occasionally go sideways. The most frequent error message is The file could not be opened because the format or extension is not valid. This usually means the file extension does not match its actual content, the file is corrupt, or it is locked by another process. Try renaming the .csv to .txt and opening it through Get Data instead of double-clicking. If the file is actually HTML or XML disguised as CSV, neither approach will work and you need to fix the source.
Scrambled characters like é, é, or □ point to an encoding mismatch. Open the source in a real text editor, check the encoding shown in the status bar, then re-import using that specific File Origin in Power Query. UTF-8 with BOM is the safest choice for new files you generate yourself. If the source system produces UTF-16 with little-endian byte order, choose 1200: Unicode in the dropdown. Never guess; always verify against the source.
Dates that import as five-digit numbers like 45678 are actually correct internally — Excel stores dates as serial numbers counted from January 1, 1900. Apply a date format from the Home tab Number group and the value displays correctly. If dates import as text strings that refuse to convert, use the DATEVALUE function or split the string with Text to Columns then reassemble with the DATE function. Power Query's Change Type Using Locale solves this cleanly for international files.
Records that span multiple lines due to embedded line breaks inside quoted fields break naive parsers but are handled correctly by Power Query and the modern From Text/CSV connector. If a single review or comment field contains paragraph breaks, the legacy Text Import Wizard splits it into multiple rows. The fix is to use Power Query, which respects the CSV specification and joins continuation lines properly. Inspecting your data with the Standard Deviation Formula in Excel after import helps spot outliers caused by botched parsing.
Truncated columns appear when a single cell exceeds the 32,767 character limit. Excel keeps the data but only displays the first 1,024 characters. Long article bodies, JSON blobs, and legal disclaimers often hit this ceiling. Move those columns to the Data Model or split them across multiple columns using LEFT and MID functions. For genuine big-text storage, consider keeping the source as text files and loading only metadata into Excel.
Phone numbers, credit cards, and account IDs frequently lose digits during import because Excel converts long numbers to floats with limited precision. Anything beyond 15 significant digits gets rounded silently. The only safe approach is to set the column to Text before parsing. If the data is already imported and broken, the original digits are lost and you must re-import from the source with the column typed correctly from the start.
Finally, when refresh fails on a previously working query, the most common cause is a renamed source file, a moved folder, or a changed column header. Open the query in the Power Query Editor and inspect the Applied Steps. Right-click Source and choose Edit Settings to update the path. If a column was renamed, edit the Changed Type or Renamed Columns step. Document your queries with comments using the // syntax in the advanced editor to make future troubleshooting easier.

Excel never warns you when it strips a leading zero, flips a date, or converts a long number to scientific notation. These changes happen silently during the import. Always spot-check a few rows of the original text file against the loaded worksheet for ID columns, dates, and any field that looked numeric but is actually a code. Catching corruption at import time is ten times easier than tracing it weeks later in a pivot report.
For files that arrive on a regular schedule with consistent structure, automation pays for itself in days. Excel offers two automation paths in 2026: classic VBA macros that work on desktop Excel, and the newer Office Scripts written in TypeScript that run on both desktop and Excel for the web. Both can be triggered manually with a button, by Power Automate on a schedule, or chained with other Office actions. Choose VBA for offline desktop workflows and Office Scripts for cloud-first teams.
To record a basic VBA macro, enable the Developer tab via File > Options > Customize Ribbon, then click Record Macro. Perform the import once manually using your preferred method, then stop recording. The generated code lives in a module under VBAProject in the Visual Basic Editor (Alt+F11). Edit the file path to make it dynamic, wrap the import in error handling, and assign the macro to a button on a worksheet. Subsequent imports take one click.
Office Scripts are written in a stripped-down TypeScript dialect and live in the cloud attached to your workbook. The Automate tab lets you record actions or write code from scratch. Scripts are limited to operations available through the JavaScript API but cover every common import scenario. Combine a script with a Power Automate flow that triggers when a file lands in OneDrive or SharePoint, and your imports run unattended on a schedule with no human involvement at all.
For very high volume work, consider skipping Excel entirely for the parsing step and using Python with pandas, which reads CSV files at over 100 megabytes per second and exports cleaned data back to .xlsx using the openpyxl library. The xlwings library bridges Python and Excel for hybrid workflows where users still interact with the spreadsheet but the heavy lifting happens in pandas. The Excel Data Analysis Toolpak covers statistical analysis once your data is loaded.
Whatever method you choose, document your import process. Add a hidden worksheet called Documentation with the file path, expected columns, locale settings, last refresh date, and contact information for whoever produces the source file. Future you, or the colleague who inherits your workbook, will save hours. Include screenshots of the Power Query Editor and the Applied Steps panel so the logic is recoverable even if the query becomes corrupted.
Version control is another underused habit. Save your import workbook to a OneDrive or SharePoint location that tracks version history. Every refresh and structural change becomes a recoverable snapshot. Combined with descriptive sheet names like RawImport, Cleaned, and Dashboard, you create an audit trail that satisfies most corporate compliance requirements without any extra tooling.
The final step in any automation project is testing edge cases. What happens when the source file is empty? When a required column is missing? When the file is locked by another process? Build error handling that posts a clear message to a status worksheet rather than failing silently. A robust import workflow does not need to be complex; it just needs to handle the predictable failure modes gracefully so users trust the output.
Now that you understand every method, here are the practical tips that separate beginners from experts. Always preview the source file in a real text editor before importing. Five seconds of inspection in Notepad++ or VS Code reveals the delimiter, encoding, line endings, and any anomalies in the first few rows. This habit prevents 90% of import surprises and takes less time than fixing a botched conversion afterward.
Name your queries descriptively. Default names like Query1 and Query2 become impossible to manage in workbooks with five or more imports. Use names like Sales_NorthAmerica_CSV or Inventory_Daily_TabDelimited. Power Query lets you rename queries by double-clicking them in the Queries pane on the right. Good names make the workbook self-documenting and dramatically speed up troubleshooting six months from now when you have forgotten what each query does.
Disable background refresh for large queries that you only need occasionally. Right-click the query, choose Properties, and uncheck Enable background refresh. This prevents the query from spinning up every time you open the workbook, which is a common cause of slow open times in finance dashboards with many connections. Refresh manually with the big green button on the Data tab when you actually need fresh data.
Use staging queries to separate raw imports from cleaned outputs. Load the raw file as a connection-only query, then build a second query that references the first and applies cleaning steps. If the cleaning logic ever needs to change, you edit one query without re-importing. If the source file format changes, you fix the source query and all downstream cleaning steps continue to work unchanged. This pattern scales from one query to fifty without becoming unmanageable.
Learn keyboard shortcuts to speed up repetitive Power Query work. Ctrl+T opens the close and load menu, Ctrl+S saves the workbook, F5 refreshes the current query, and Alt+F12 launches the Power Query Editor directly. The Up and Down arrows navigate the Applied Steps panel without taking your hands off the keyboard. These small wins compound into significant time savings over weeks of regular use.
When sharing workbooks containing Power Query, remember that the recipient needs both the workbook and access to the source file. Embed sample data in a hidden worksheet for demos and switch the query source to that worksheet for portability. Alternatively, paste-values the final output into a static sheet and remove the query before distribution. Each approach has trade-offs between freshness and portability that depend on your audience.
Finally, invest twenty minutes a week practicing on real-world messy data. The Kaggle datasets repository offers thousands of free CSVs with realistic problems: inconsistent dates, missing values, mixed encodings, and embedded quotes. Working through unfamiliar files builds the pattern recognition that turns a slow methodical importer into someone who can convert any text file to a clean Excel table in under two minutes regardless of how the source was formatted.
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.