How to Fix Microsoft 365 Excel Freezing When Exporting to CSV
Question details
Excel freezes indefinitely when exporting around 18,000 rows to a CSV file using a custom Ribbon command, requiring the application to be force-closed.

- Product
- Microsoft 365
- Device & OS
- not provided
- Scenario
- A user is attempting to export a moderate dataset (18,000 rows) to a CSV file via a custom ribbon macro in Microsoft 365 Family.
- Observed behavior
- The export process runs continuously without completing, hanging the application and forcing the user to manually terminate the program.
Before initiating any repairs, ensure all your current workbooks are saved and closed, and verify that Windows is fully updated to avoid conflicts with pending system installations.
Perform an Online Repair of Microsoft Office
Running the built-in Microsoft Office repair utility resolves corrupted installation files that can cause Excel to hang during export tasks.
Microsoft Office includes a specialized repair tool that scans for missing or damaged program files. Because the software hangs indefinitely even on smaller datasets, a corrupted core file handling the export process is the most likely culprit.
Press the Windows key, type 'Control Panel', and press Enter. Under the 'Programs' section, click on 'Uninstall a program' to view your installed applications.
Scroll through the list of applications to find 'Microsoft 365' (or your specific Office version), right-click it, and select 'Change'.
When the repair dialogue appears, select 'Online Repair' (which is more comprehensive than Quick Repair) and click 'Repair'. Follow the on-screen prompts until the process finishes.

Troubleshoot the Custom Ribbon Command Macro
Since the freeze occurs when using a custom Ribbon command, the underlying VBA code may be caught in an infinite loop.
Export Large CSV Files Seamlessly with WPS Office
If Microsoft 365 continues to crash or freeze when exporting large datasets, consider switching to WPS Office. It effortlessly manages massive spreadsheets, features a familiar interface, and flawlessly exports to CSV without hanging.
- 1. Download WPS Office: Visit the official WPS website to download and install the free Office suite.
- 2. Open Your Dataset: Launch WPS Spreadsheet and open your existing .xlsx workbook.
- 3. Export Natively: Click on 'Menu', select 'Save As', choose 'CSV (Comma delimited)' from the file format dropdown, and click 'Save'.

Frequently Asked Questions
Why does Excel freeze when saving as a CSV file?
Excel may freeze during a CSV export due to a damaged Office installation, inadequate system memory, highly unoptimized custom VBA macros, or third-party add-ins conflicting with the save process.
Does the Microsoft Office Online Repair delete my existing Excel workbooks?
No, the Online Repair tool only reinstalls and repairs the core Microsoft 365 program files. Your personal documents, workbooks, and most user settings remain completely untouched.
How many rows can Excel export to CSV without crashing?
While Excel technically supports up to 1,048,576 rows, exporting performance heavily depends on your computer's RAM, the number of columns, and whether you are using a native export or a custom macro. 18,000 rows should normally export within seconds.
How do I forcefully close Excel when it freezes during an export?
Press 'Ctrl + Shift + Esc' to open the Task Manager. Locate 'Microsoft Excel' in the Processes tab, click it, and select 'End task' at the top or bottom right corner to force it to close.




