Python Convert XLS (2003) to XLSX

Asked

Viewed 192 times

-1

Good Morning!

Guys, I have a directory with several spreadsheets exported from my system in XLS format (Excel format 97 - 2003), I need to write a script to go through this directory and convert these spreadsheets to XLSX. The XLDR and Openpyxl libraries cannot read my spreadsheets, due to the format.

Could someone give me a hand, or indicate some library?

I accept tips in C# and Java as well

  • With C# you can useSpire.XLS: workbook.LoadFromFile("Input.xls"); workbook.SaveToFile("Output.xlsx", ExcelVersion.Version2013);

1 answer

-1

Simple Solution I required a simple Solution to Convert Couple of xlx to xlsx format. There are Plenty of Answers here, but they are Doing some "Magic" that I do not completely understand.

A simple Solution was Given by chfw, but not quite complete.

Install dependencies Use Pip to install

pip install pyexcel-cli pyexcel-xls pyexcel-xlsx

Execute All the styling and macros will be Gone, but the information is intact.

For single file

pyexcel transcode your-file-in.xls your-new-file-out.xlsx

For all files in the Folder, one Liner

for file in *.xls; do; echo "Transcoding $file"; pyexcel transcode "$file" "${file}x";

 done;
  • 3

    Fabio, this site is the [en.so]. Please click on [Edit] and translate the answer...

Browser other questions tagged

You are not signed in. Login or sign up in order to post.