8

Excel compresses its files using Zip-Deflate and stores it. However, the compression level is far from the best. To reduce the size and send it across I have to unzip and re-zip it manually everytime. Is there a way to change the compression level setting in excel so that it compresses and stores the file using best method possible?

13
  • 2
    Perhaps just save is as a binary file (XLSB) instead? Apr 17, 2014 at 20:10
  • @Techie How converting to binary helps?
    – EliadTech
    Apr 17, 2014 at 20:41
  • The file size will be much smaller. Try it and let us know how it goes. Apr 17, 2014 at 21:01
  • Saving to binary doesn't help significantly. Not nearly as significant as unzip and rezip. Perhaps there is an option for default compression level somewhere?
    – OrangeRind
    Apr 28, 2014 at 5:41
  • What version of excel and windows are you using? How are you zipping it with excel (filetype and whatnot)? May 8, 2014 at 18:05

2 Answers 2

2
+50

You can also through a VBA macro replace the zip engine.
A macro that uses 7Zip to do the compression can be found in the article:
Zip Activeworkbook, Folder, File or Files with 7-Zip (VBA).

Another method which usually gets about 50% improvement in size is by saving the file in the xlsb format that was introduced in Excel 2007. Still another one is to Save As the file, which sometimes reduces its size, presumably by defragmenting.

From the post In which case should we use the xlsm or the xlsb format? :

The difference with xlsb seems to be that the components are not XML-based but are in a binary format: supposedly this is beneficial when working with large files. source

.xlsx loads 4 times longer than .xlsb and saves 2 times slower and has 1.5 times a bigger file. I tested this on a generated worksheet with 10'000 rows * 1'000 columns = 10'000'000 (10^7) cells of simple chained =…+1 formulas

There are also generic methods for reducing the size of an Excel file. See for example:

How to Reduce Size of Excel Files
How to reduce a huge excel file
How to reduce excel file size

4
  • 2
    XLSX -> 712MB (uncompressed), 78MB (native), 42MB (rezip). XLSB -> 498MB (uncompressed), 45MB (native), 30MB (rezip).
    – OrangeRind
    May 9, 2014 at 15:16
  • 2
    Point is, the binary format does help in huge files, but it is still suffering from the same problem of inefficient ZIP compression because of a speed tradeoff. Perhaps some add-in or macro can help out to save to the higher compression level by default?
    – OrangeRind
    May 9, 2014 at 15:18
  • The code you linked to does not appear to replace the zip engine at all but just provides a macro interface to zip or 7zip to compress an already created workbook which does not seem to do what OP was actually asking. It's compressing after Excel has done it's poor job...
    – Mokubai
    May 12, 2014 at 6:49
  • @Mokubai: That's what he does now and wants to avoid - he is asking for an easier way than he currently does : rename-unzip-rezip-rename.
    – harrymc
    May 12, 2014 at 8:06
2

A workaround is to recompress the XLSX ZIP files.
You could use the AdvanceCOMP advzip utility for this. To use the 7z compressor run:

advzip --recompress --shrink-extra huge.xlsx

If you have the time, use the zopfli compressor:

advzip --recompress --shrink-insane huge.xlsx

You can also increase the number of iterations for the compression by using the --iter option.

1
  • Basically it's a command to re-zip instead of manually. There should be an option in Excel but unfortunately, it's not. Apr 15, 2020 at 9:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .