How to Fix Excel 'Write to File Failed' Error When Exporting to TXT
Question details
The user is unable to export an Excel workbook to a text (.txt) file due to a 'Write to file failed' error message.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- Exporting spreadsheet data to a plain text format (.txt) for external use or data migration.
- Observed behavior
- Excel interrupts the export process and displays a 'Write to file failed' alert, failing to save the output file.
Ensure that you do not have the destination TXT file open in another program, such as Notepad or a text editor, as this will lock the file and prevent Excel from overwriting it.
Save to a Local Folder and Verify Write Permissions
By changing the destination folder to a standard local directory and verifying permissions, you can bypass network or system restrictions blocking the export.
Network drives, synced cloud folders, or restricted system directories often cause write failures. Moving the export destination to a basic local folder ensures Excel has full access to create the file.
Click 'File' > 'Save As' and choose a standard local folder on your computer, such as your 'Documents' or 'Desktop' folder.
Right-click the destination folder in File Explorer, select 'Properties', and ensure the 'Read-only' attribute is unchecked. Click 'Apply' to confirm.
In Excel, select 'Text (Tab delimited) (*.txt)' from the 'Save as type' dropdown and click 'Save'.

Shorten the File Path and Remove Unsupported Characters
Excessively long folder paths or invalid characters in the file name can cause Excel to fail during the file creation process.
Check Antivirus and Security Software
Sometimes strict antivirus programs block Office applications from writing new files to the disk to prevent ransomware.
Export Data to TXT Seamlessly with WPS Office
If Microsoft Excel continues to display write errors, try WPS Office. It is a free, lightweight, and highly compatible alternative that makes exporting spreadsheets to TXT and CSV formats fast and error-free.
- 1. Install WPS Office: Download and install WPS Office for free from the official website.
- 2. Open Your Spreadsheet: Open your original .xlsx or .xls file using WPS Spreadsheet.
- 3. Export to TXT: Click 'Menu', select 'Save As', choose 'Text (Tab delimited) (*.txt)', and click 'Save'.

Frequently Asked Questions
Why does Excel say my file is locked when exporting to TXT?
This usually happens if the target TXT file is already open in another program like Notepad, or if a previous Excel export process crashed and left the file locked in the background. Closing all text editors should release the lock.
Can a long file path cause the 'Write to file failed' error?
Yes, Windows has a maximum path length limit (typically 260 characters). If your destination folder structure is deeply nested, Excel will be unable to write the file. Try saving it directly to a root folder or your Desktop.
Does a 'Read-only' folder status affect saving TXT files in Excel?
Absolutely. If the destination folder lacks write permissions or is marked as 'Read-only', Excel cannot create or overwrite files in that location. You must change the folder properties or choose a different directory where you have full administrator privileges.




