How to export Excel data to Text files in Excel?
If you are required to deliver a workbook in the format of text file, you need to convert the workbook into text files. And this article will introduce you two methods to export Excel data into text files easily.
Recommended Productivity SoftwareOffice Tab: Use tabbed interface in Office as the use of web browser Chrome, Firefox and Internet Explorer.
Kutools for Excel: Adds 120 powerful new features to Excel. Increase your productivity in 5 minutes. Save two hours every day!
Classic Menu for Office: Brings back your familiar menus to Office 2007, 2010 and 2013 (includes Office 365).
By default, the Excel data will be saved as workbooks in the format of .xlsx. However, we can export a worksheet of existing workbook as text files with the following steps:
Step 1: Click the Save as button under File tab in Excel 2010; in Excel 2007 click the Office Button and Save as button;
Step 2: Save As dialog box comes out. Name the file in the File name text box and select the folder that you will save the file in;
Step 3: In the Save as type drop down list, select the Unicode Text . See screenshot:
Step 4: Then it will pop up two warning dialog boxes asking you to export only active worksheet as text file and leave out any incompatible features with text file. Click OK and Yes.
Then the data in the active worksheet are exported as a new text file.
Note: the Save As command is only able to export data of active worksheet as a text file. If you want to export all data of the whole workbook, you need to save each worksheet as a text file individually.
The following VBA code also can help you to export the selected range data or entire worksheet to the text file, please do as this:
Step 1. Hold down the ALT + F11 keys, and it opens the Microsoft Visual Basic for Applications window.
Step 2. Click Insert > Module, and paste the following code in the Module Window.
VBA: export selection or entire worksheet to text file
Sub ExportRangetoFile() 'Update 20130913 Dim wb As Workbook Dim saveFile As String Dim WorkRng As Range On Error Resume Next xTitleId = "KutoolsforExcel" Set WorkRng = Application.Selection Set WorkRng = Application.InputBox("Range", xTitleId, WorkRng.Address, Type:=8) Application.ScreenUpdating = False Application.DisplayAlerts = False Set wb = Application.Workbooks.Add WorkRng.Copy wb.Worksheets(1).Paste saveFile = Application.GetSaveAsFilename(fileFilter:="Text Files (*.txt), *.txt") wb.SaveAs Filename:=saveFile, FileFormat:=xlText, CreateBackup:=False wb.Close Application.CutCopyMode = False Application.DisplayAlerts = True Application.ScreenUpdating = True End Sub
Step 3. Then press F5 key to run this code, and a prompt box will pop out to tell you to select the data range that you want to export, see screenshot:
Note: If you want to export the entire worksheet, in the above prompt box, hold down the Ctrl + A keys.
Step 4. Then click OK, and specify a name for this text file and a folder to put this file in the popped out Save As dialog.
Step 4. Then click Save button, and the selected data range has been exported as text file.
The Save As command can export all data in the active worksheet as text. What if exporting all data of specified inactive worksheets, or part of the data in a worksheet as a text file? Kutools for Excel's Export Range to File tool can help us export and save the data in any worksheet as text file easily no matter it is active or not.
Kutools for Excel includes more than 120 handy Excel tools. Free to try with no limitation in 30 days. Get it Now.
After installing Kutools for Excel, please do as following steps:
Step 1: Click Enterprise > Import / Export > Export Range to File, see screenshot:
Step 2: In the Export Range to File dialog box, do following options:
- (1.) Click the button to select a range that you want to export its data as a text file. If you want to export the entire worksheet, after clicking the button, then hold down the Ctrl + A keys.
- (2.) Then check the Unicode Text option under File format, and then choose the text options as you need, see screenshot:
Step 3: Then click OK, and specify a name and a location for the exported range file.
Step 4: And then click Save, now the selected range is exported as a new text file. See screenshot:
Kutools for Excel's Export Range to File tool makes it possible to easily export a range of date to a file, either an Excel workbook, a CSV, a simple HTML or all formatting HTML.
- Export Excel data to CSV files in Excel
- Export Excel data as HTML
- Save a selection as individual file
- Save selection or entire workbook as PDF
Is your problem solved?
Recommended Productivity Tools
Office Tab: Using handy tabs in your Office, as the way of Chrome, Firefox and New Internet Explorer.
Kutools for Excel: 120 powerful new functions for Excel, Increase your productivity in 5 minutes. Save two hours every day!
Classic Menu for Office: Bring back familiar menus to Office 2007, 2010, 2013 and 365, as if it were Office 2000 and 2003.
Amazing! Increase your productivity in 5 minutes. Don't need any special skills, save two hours every day!
More than 120 powerful advanced functions which designed for Excel:
- Merge Cell/Rows/Columns without Losing Data.
- Combine and Consolidate Multiple Sheets and Workbooks.
- Compare Ranges, Copy Multiple Ranges, Convert Text to Date, Unit and Currency Conversion.
- Count by Colors, Paging Subtotals, Advanced Sort and Super Filter,
- More Select/Insert/Delete/Text/Format/Link/Comment/Workbooks/Worksheets Tools...