Read .xlsm file as .xlm

easperhe29

New Member
Joined
May 11, 2024
Messages
3
Office Version
  1. 365
Platform
  1. Windows
If I save a .xlsx/m file in .xml format, I can read the .xml format MUCH faster than the .xlsm format. when processing 100s of files, this can make a ~30x reduction in runtime. Since .xlsx/m are compressed xml, is there any way to read in the .xlsx/m file as a xlm file directly? I believe this is effectively what openpyxl within python does.
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
There is. As you point out, XLSX/XLSM files are essentially a collection of compressed XML files (for the most part), and it is indeed quicker to parse through those files than opening up each file changing it/saving it, etc.

@johnnyL and I had a project a few years ago which used this method to correct workbooks with phantom rows/columns/cells. We demonstrate the method here: Alternative approach to fix those problematic excel files when excel sees 1048576 as the last row # & you can't fix it.

I believe you're right about the openpyxl method - that's been my understanding, but without reading the source code, my suspicion is that it uses a ZIP reader that decompresses the byte data of certain segments of the file, thereby avoiding the need to decompress the files using the Shell method, which is what we have done above. I believe Cristian Buse's ZipTools library should be able to do it, but I haven't checked: GitHub - cristianbuse/Excel-ZipTools: Interact with the component parts of an Excel file

Separately, depending on what it is that you want to do exactly, if all you're doing is extracting data from workbooks, you could always try PowerQuery or ADODB methods.
 
Upvote 0
Solution

Forum statistics

Threads
1,220,965
Messages
6,157,119
Members
451,398
Latest member
rjsteward

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top