I'm searching for a Python library that can handle converting both XLSX and XLS files to CSV format. Ideally, it should allow customization options, such as changing the delimiter (for example, using | instead of ,) and managing multiple tabs or sheets within the Excel file—either by combining all into one CSV or creating separate files for each tab. Also, I'd like the library to support the reverse function: converting CSV back to XLSX or XLS, with similar customization for delimiters and the ability to merge multiple CSVs into a single Excel file—either as one sheet or separate sheets for each CSV. I've heard about Pandas being capable of file conversions, but I am unsure if it offers all the features I need or if it's the fastest option. Any recommendations would be greatly appreciated!
3 Answers
Pandas can do all of this! It handles most, if not all, of your requirements for converting Excel to CSV and vice versa. It's versatile enough to customize delimiters and manage multiple sheets, so it sounds like a good fit for your needs.
Polars is the easiest to use for your requirements. Here are some links:
- [Read Excel](https://docs.pola.rs/api/python/stable/reference/api/polars.read_excel.html#polars.read_excel)
- [Write CSV](https://docs.pola.rs/api/python/stable/reference/api/polars.DataFrame.write_csv.html)
- [Read CSV](https://docs.pola.rs/api/python/stable/reference/api/polars.read_csv.html)
- [Write Excel](https://docs.pola.rs/api/python/stable/reference/api/polars.DataFrame.write_excel.html)
If you want speed, dive deeper into libraries like xlsx2csv or look into the calamine library, which Polars uses.
Definitely consider Pandas! For better performance, though, you might want to check out Polars. It’s designed for speed and can efficiently handle the conversions you need. Just look at the documentation for the exact functions you'll need.

Absolutely! Calamine with Polars will give you top performance for these tasks. It's worth considering.