Bulk XLS to CSV Conversion – Convert 100s of Files Automatically
Introduction
If you have dozens or hundreds of XLS files that need to be converted to CSV, converting them one by one in Excel would take hours. Bulk conversion tools and scripts can automate this process and convert an entire folder of files in seconds or minutes.
In this guide, we cover all methods for batch XLS to CSV conversion — from Python scripts to online tools to PowerShell automation.
When Do You Need Bulk XLS to CSV Conversion?
- Monthly reports exported from ERP systems in XLS format that need to be loaded into a database as CSV
- Legacy data migration projects with thousands of XLS files
- Automated data pipelines that receive XLS files and need to standardize them to CSV
- Archiving historical Excel files into a more portable plain-text format
- Data science projects where raw data arrives in XLS format
Method 1: Bulk XLS to CSV with Python (Recommended)
Python is the most reliable and scalable method for bulk conversion. It handles edge cases, large files, and can be fully automated.
Complete Batch Converter Script
import pandas as pd
import glob
import os
import logging
from pathlib import Path
logging.basicConfig(level=logging.INFO, format=’%(asctime)s – %(message)s’)
def bulk_xls_to_csv(
input_folder: str,
output_folder: str,
encoding: str = ‘utf-8’,
all_sheets: bool = False
) -> dict:
“””
Bulk convert all XLS/XLSX files in a folder to CSV.
Args:
input_folder: Path to folder containing XLS files
output_folder: Path to folder for output CSV files
encoding: CSV encoding (default: utf-8)
all_sheets: If True, convert each sheet to a separate CSV
Returns:
dict with ‘success’, ‘failed’, and ‘skipped’ counts
“””
Path(output_folder).mkdir(parents=True, exist_ok=True)
results = {‘success’: 0, ‘failed’: 0, ‘skipped’: 0}
xls_files = glob.glob(os.path.join(input_folder, ‘**/*.xls*’), recursive=True)
if not xls_files:
logging.warning(‘No XLS/XLSX files found in: ‘ + input_folder)
return results
logging.info(f’Found {len(xls_files)} files to convert…’)
for xls_path in xls_files:
try:
base_name = Path(xls_path).stem
if all_sheets:
xls = pd.ExcelFile(xls_path)
for sheet in xls.sheet_names:
df = pd.read_excel(xls, sheet_name=sheet)
out = os.path.join(output_folder, f'{base_name}_{sheet}.csv’)
df.to_csv(out, index=False, encoding=encoding)
else:
df = pd.read_excel(xls_path, sheet_name=0)
out = os.path.join(output_folder, f'{base_name}.csv’)
df.to_csv(out, index=False, encoding=encoding)
logging.info(f’Converted: {Path(xls_path).name}’)
results[‘success’] += 1
except Exception as e:
logging.error(f’Failed: {Path(xls_path).name} – {e}’)
results[‘failed’] += 1
logging.info(f”Done! Success: {results[‘success’]}, Failed: {results[‘failed’]}”)
return results
# Usage
bulk_xls_to_csv(
input_folder=’./excel_files’,
output_folder=’./csv_output’,
encoding=’utf-8′,
all_sheets=False
)
Method 2: Bulk Convert Using PowerShell (Windows)
For Windows users without Python, PowerShell can batch convert all XLS files in a folder:
$Source = ‘C:\Excel_Files’
$Dest = ‘C:\CSV_Output’
New-Item -ItemType Directory -Force -Path $Dest | Out-Null
$Excel = New-Object -ComObject Excel.Application
$Excel.Visible = $false
$Excel.DisplayAlerts = $false
$Count = 0
Get-ChildItem -Path $Source -Include ‘*.xls’,’*.xlsx’ -Recurse | ForEach-Object {
$Out = Join-Path $Dest ($_.BaseName + ‘.csv’)
$wb = $Excel.Workbooks.Open($_.FullName)
$wb.SaveAs($Out, 6)
$wb.Close($false)
$Count++
Write-Host “[$Count] $($_.Name) -> converted”
}
$Excel.Quit()
Write-Host “Batch complete. $Count files converted.”
Method 3: Bulk Conversion with Online Tools
For users who prefer no-code solutions, some online tools support batch uploading. Convertio and CloudConvert both support uploading multiple files at once and downloading them as a ZIP archive. Free limits typically apply.
Performance Tips for Large Batch Conversions
- Process files in parallel using Python’s multiprocessing module for 4x-8x speed improvement on multi-core machines.
- Use SSD storage for input and output folders to minimize I/O bottleneck.
- If files have many sheets, use all_sheets=False to only convert the first sheet unless all sheets are needed.
- For files over 100MB each, increase Python’s default memory or process them with chunking.
- Log failed conversions to a separate file so you can retry them without reprocessing successful ones.
How Long Does Bulk XLS to CSV Conversion Take?
| Files | Avg Size | Python Time | PowerShell Time |
| 10 files | 1 MB each | ~5 seconds | ~30 seconds |
| 100 files | 1 MB each | ~45 seconds | ~5 minutes |
| 1000 files | 1 MB each | ~7 minutes | ~50 minutes |
| 50 files | 50 MB each | ~10 minutes | ~30 minutes |
Frequently Asked Questions (FAQs)
How do I convert hundreds of XLS files to CSV for free?
Python with pandas is the best free option. Install it with pip install pandas openpyxl, then use our batch script above to convert an entire folder automatically. It is completely free and runs on Windows, Mac, and Linux.
Can I bulk convert XLS files without opening Excel?
Yes! Python’s pandas library reads XLS/XLSX files directly without Excel. This is ideal for servers, Linux machines, or environments where Excel is not installed.
What happens if one file fails during bulk conversion?
Our Python script above uses try/except to catch errors and continue processing the remaining files. Failed files are logged separately so you can investigate and retry them individually.
Can I bulk convert CSV files back to XLS?
Yes! The same Python approach works in reverse. Use pd.read_csv() and df.to_excel() in a loop. See our Convert CSV to XLS Guide for the full reverse conversion tutorial.
How do I convert XLS files with multiple sheets to separate CSV files?
Use the all_sheets=True parameter in our batch script above. This will create a separate CSV for each sheet in each XLS file, named as filename_sheetname.csv.
Internal Linking Suggestions
- Convert XLS to CSV – Main Guide – /convert-xls-to-csv
- Convert CSV to XLS Guide – /convert-csv-to-xls
- XLS to CSV with Python – /xls-to-csv-python
- Online XLS to CSV Converter – /online-xls-to-csv