Batch Convert Multiple Excel Files to CSV
How to convert 100 Excel files to CSV at once. Use VBA macros, Python scripts, or batch converters to save hours of manual work.
Batch Convert Multiple Excel Files to CSV
You have a folder with 500 .xlsx files. You need them all as .csv files for a database import.
Opening and saving each one manually would take hours. Let's do it in seconds.
Method 1: VBA Macro (Windows Only)
You can run a macro inside Excel to process a whole folder.
- Open a blank Excel file.
- Alt+F11 (VBA Editor).
- Insert > Module.
- Paste this:
Sub BatchConvertToCSV()
Dim strFile As String
Dim strPath As String
Dim wbk As Workbook
' Change this to your folder path (end with backslash)
strPath = "C:\MyFiles\"
strFile = Dir(strPath & "*.xlsx")
Do While strFile <> ""
Set wbk = Workbooks.Open(strPath & strFile)
' Save as CSV
wbk.SaveAs Filename:=strPath & Replace(strFile, ".xlsx", ".csv"), FileFormat:=xlCSV
wbk.Close SaveChanges:=False
strFile = Dir
Loop
End Sub
- Run it. Watch the screen flash as it processes everything.
Method 2: Python (Cross-Platform)
The best way. Works on Mac, Windows, Linux.
import pandas as pd
import glob
import os
# Get all Excel files
files = glob.glob("*.xlsx")
for file in files:
# Read Excel
df = pd.read_excel(file)
# Create new filename
new_name = file.replace('.xlsx', '.csv')
# Save as CSV
df.to_csv(new_name, index=False)
print(f"Converted {file} to {new_name}")
Pros:
- No Excel license needed (if using Python).
- Very fast.
- Can run in background.
Method 3: Mac Automator (macOS Only)
Mac has a built-in automation tool.
- Open Automator.
- Create a new Application.
- Search for "Convert Format of Excel Files" (requires Excel installed).
- Drag it to the workflow.
- Change "Convert to" -> CSV.
- Save the app as "Excel to CSV Droplet".
- Drag and drop your 500 files onto this new app icon. It will process them all.
Method 4: LibreOffice (Command Line)
If you don't have Excel but have LibreOffice (free).
soffice --headless --convert-to csv *.xlsx
This command converts every Excel file in the folder to CSV without opening the GUI.
Summary
- Windows: Use VBA.
- Mac: Use Automator.
- Developer: Use Python or LibreOffice.
- Manual: Don't do it.
Converting files? HappyCSV supports batch processing to convert your data formats instantly.
Related Articles
Anonymize CSV Data (GDPR/Testing)
How to mask sensitive data in CSV files. Anonymize names, emails, and phones for testing or GDPR compliance.
Best Free CSV Viewers for Mac & Windows
Excel isn't the only way to open CSVs. Check out the best free CSV viewers like Tad, Miller, and online tools for large files.
How to Clean Email Lists Before Sending (5-Step Guide)
Clean your email list to improve deliverability and avoid spam complaints. Remove duplicates, validate formats, and fix common issues.
Need to handle CSV files?
HappyCSV is the free, secure way to merge, split, and clean your data — all in your browser.