Содержание
- Zipping and unzipping Excel xlsx files
- 8 Ways to Reduce Excel File Size (that actually work)
- Tips to Reduce Excel File Size
- Remove Unnecessary Worksheets/Data
- Convert to Binary Format (XLSB)
- What is XLSB?
- XLSB Vs XLSX/XLSM
- Remove Unnecessary Formulas
- Compress Images (Before and After Uploading)
- Remove Pivot Cache to Save Space
- Keep the Source Data and Delete Pivot Cache
- Keep the Pivot Cache and Delete the Source Data
- Compress the File (ZIP IT)
- Remove Data formatting
- Remove Conditional formatting
- Excel Performance Booster Tips
Zipping and unzipping Excel xlsx files
There are different algorithms that can be used for storing files within a zip file that determine the level of compression and speed of production of a zip file. If you are using a Linux or Apple OS X system, you can see choices that are available for compressing files and directories into a zip file from the command line, e.g. from a Terminal window on an OS X system, by looking at the man page for the zip program by issuing the command man zip . The following options are available for file compression:
Excel uses the «deflate» storage method as can be seen for the following Example.xlsx file produced by Microsoft Excel for Mac 2011 on a MacBook Pro laptop by using the zipinfo command, which lists detailed information about zip archives. The Example workbook has two worksheets with the default names of sheet1 and sheet2 .
The «defS» in the sixth column indicates the compression method used. There are six methods known at present: storing (no compression), reducing, shrinking, imploding, tokenizing (never publicly released), and deflating. In addition, there are four levels of reducing (1 through 4); four types of imploding (4K or 8K sliding dictionary, and 2 or 3 Shannon-Fano trees); and four levels of deflating (superfast, fast, normal, maximum compression). zipinfo represents these methods and their sub-methods as follows: stor; re:1, re:2, etc.; shrk; i4:2, i8:3, etc.; tokn; and defS, defF, defN, and defX.
If I rename the Example.xlsx file to Example.zip and extract its contents and then rezip the contents of the directory produced when I extracted the contents of the zip file with the zip utility, I see the following:
I.e., I see that, by default, the deflation method is being used for files. If I then check the .zip file produced by the zip utility with the zipinfo utility, I see «defN» listed in the sixth column for the compression method.
Deflation is the default compression method, but using the zip utility on an OS X system I can specify the level of reducing to be 1 using -Z deflate -1 . I then see the compression method listed as «defF».
Using -2 for the level of delation also results in the deflation method shown by zipinfo being «defF». If -3 is used, «defN» is shown; «defN» is also shown by zipinfo if -4 is used as an argument to the zip command. If I issue the command zip -r —n Example.zip Example/* , where n is a number between 0 and 9, on an OS X system, I see the following methods listed when I check the resulting zip file with zipinfo.
Number | Method | |
---|---|---|
0 | stor | |
1 | defF | |
2 | defF | |
3 | defN | |
4 | defN | |
5 | defN | |
6 | defN | |
7 | defN | |
8 | defX | |
9 | defX |
You might expect that you could recompress the folder where the files were extracted to produce a new zip file and then rename that to be a .xlsx file which you could then open with Excel. That won’t work, however. If you right click on the directory containing the extracted files from the Finder application and choose Compress dirname where dirname is the relevant directory name, that will produce a new zip file. E.g., if the file you started from was Example.xls and you renamed it to Example.zip and then extracted the contents of the zip file to the directory Example , you would now have a Example.zip file again. You can right-click on it and rename the extension back to .xlsx, but if you try to open that file with Excel you will see the message «file format is not valid». You will also have the same problem if you use the command line zip program, e.g., if you used zip -r Example.zip Example/* . The zip file produced by those methods on an Apple OS X system does not match what Excel is expecting.
If you create a zip file with the Python zipfile module, the deflate method is used by default and you will see «defN», if you check the zip file created with that module. You can create a zip file of a directory from the command line with that module using the command python -m zipfile -c zipfilename directory where zipfilename is the name you wish to give to the zip file and directory is the directory you wish to compress into a zip file. E.g., python -m zipfile -c Example.zip Example/ . You will also not be able to open the zip file produced by that method with Excel by simply renaming the file to have a .xlsx rather than a .zip extension. You will again get the «file format is not valid» message, if you try to open the file in Excel.
However, if you use the Python shutil module to create the zip file from the directory and then rename the zip file to a .xlsx file, you can open it in Excel. The zipdir.py Python script can be used to create a zip file that can be opened with Excel after changing the file extension.
I noticed that when I produce zip files from a directory on an OS X system using methods other than with the Python shutil module, that the directories are shown with the «stor» compression method. I.e., they are stored with no compression employed. When I compress the directory with zipdir.py E.g., zipinfo shows the following information for a zip file produced by python -m zipfile -c Example.zip Example/ :
But the same directory when compressed by zipdir.py with the Python shutil module into a zip file produces a zip file for which zipinfo shows the following information:
So, perhaps, the issue is caused by the directory information being «stored» rather than deflation being used.
Note: testing done on a MacBook Pro laptop running OS X Yosemite (10.10.5) using Microsoft Office for Mac 2011.
Created: Monday November 14, 2016
Last modified: Monday November 14, 2016 10:32 PM
Источник
8 Ways to Reduce Excel File Size (that actually work)
Excel workbooks have been known to become painfully slow and heavy as more data/formulas/images are added to it.
Sometimes, it’s easy to get rid of the extra flab and keep the excel file size in check, and sometimes, it isn’t.
And since Excel is not a web-based tool, most of us work and collaborate by sending Excel files via email. And a large Excel file that weighs 50 MB can be hard to share with your colleagues/clients.
In my last job, we used Lotus Notes email client, which is snail-slow, and sending heavy Excel files over that was torture.
While there is no magical way to reduce the size of an Excel workbook, there are a few techniques that you can use to cut down some flab.
This Tutorial Covers:
Tips to Reduce Excel File Size
Below are the techniques you can use to reduce the file size of your Excel workbook.
For each tip, I have done some testing and have added the snapshots to show you the impact on file size. The results you get would vary depending upon your data and files.
Based on your workbook, you can use one or more of these tips.
Remove Unnecessary Worksheets/Data
The best solutions are often the easiest ones.
And this technique is more of common sense and less of any Excel wizardry.
If you have an Excel workbook that has some worksheets that are not needed (and are not being used in any formulas), see if you can get rid of those.
This has a direct correlation with the Excel file size. So as soon as you delete some of the worksheets and save the workbook, you will instantly see a reduced file size.
Test Results:
I created an Excel file with 10 worksheets where each worksheet has 2.6 million data points (26 columns with 100,000 data points in each column).
The resulting size of this workbook is 143 MB (and it’s taking quite some time to save and open).
Now when I deleted five sheets, the size reduced by half (duh).
As you can see, data that you have your worksheet has a direct correlation with the file size.
Convert to Binary Format (XLSB)
Do you know that just by saving an Excel file in the XLSB format can reduce the file size?
All you have to do is while saving a workbook, use the .xlsb format.
Here are the steps to do this:
- Click the File tab.
- Click on Save As.
- Click on Browse.
- In the Save As dialog box, change the file type to Excel Binary Workbook (.xlsb)
Test Results
I had an Excel workbook that took 14.6 MB of space.
After converting the same file to the XLSB format, I was able to reduce the size to 10.4 MB (a size reduction of
What is XLSB?
When you save an Excel file (.xlsx or .xlsm), it gets saved in the XML format.
For example, if I change the file extension of the XLSX file to ZIP and then open it, this is what I get.
And if I further go in the ‘xl’ folder and then go in the worksheet folder, it shows me the worksheets in that workbook (and these worksheets are saved as an XML document).
Now let’s do the same with an XLSB file.
So I first change the file extension to ZIP, then open it and locate sheet1. Here is what you get:
You’ll notice that both XLSX and XLSB saves the worksheet in a different format.
XLSX/XLSM saves it as an XML file and XLSB saves it as a binary (.bin) file.
And without getting too technical, XML files are large in size as compared to a binary file.
So when you save your Excel workbook in the XLSB format, the file size is reduced. In our above example, the size reduction was
XLSB Vs XLSX/XLSM
When it comes to using the XLSB format, size reduction is a huge benefit. But you need to be a bit cautious when working with the XLSB format.
Advantages of XLSB format:
- It reduces the Excel file size. This can be helpful when you have large files and you want to share it over email. You can quickly reduce the size by saving it in XLSB.
- XLSB files tend to open and save faster than XML file. Based on the limited tests I did, XLSB files were opening and saving 25%-50% faster. This difference is noticeable in large Excel files only. With smaller files, both XLSB and XLSX are fast.
While XLSB looks great, there are a few reasons you should stick to using XLSX/XLSM files:
- With XLSB format, you have no way of knowing whether it has a macro or not. This makes it riskier as someone can use it to execute malicious code.
- XLSB files are encoded in proprietary bin file format while XML is an open-source readable file format. This means that if you’re using third-party tools with Excel, it’s better to use XML format.
- Power Query cannot read data from an XLSB file. So if you use Power Query, it’s better to have your data in XLSX/XLSM formats.
As a general rule, if your file size is small (less than 5 MB), it’s better to stick to XLSX/XLSM formats.
Based on what I heard from people and read on many forums, a lot of people prefer to use XLSB as the file format when it comes to using Excel.
Here is a good article on understanding the XLSB format.
Remove Unnecessary Formulas
Too many formulas will bloat your workbook file size.
So if you have a data set that you need, but don’t need the formulas in it, it’s better to convert these formulas into values.
Here are the steps to quickly convert formulas to values in Excel:
- Select the entire worksheet/dataset.
- Press the F5 key.
- In the Go To dialog box, click on ‘Special’.
- In the Go To Special dialog box, select Formulas.
- Click OK.
The above steps would select all the cells that have a formula in it.
Now use the below steps to convert these formulas into values:
- Copy the selected cells (control + C)
- Click the Home tab.
- In the Clipboard group, click on Paste.
- Click on Paste Value icon.
The above steps would convert all the cells with formulas into values.
Test Results
I created an Excel file with 2.7 million data points (1048576*26) and then added three columns with formulas (SUM, COUNT and AVERAGE).
Then I converted these formulas into values and saved the file with a different name.
Below is the result:
The file with no formulas is
8% less in size (and note that I only had 3 columns of formulas).
In case you have a lot of formulas, it can add to the size.
Compress Images (Before and After Uploading)
If you work with Excel files that have images in it, you need to optimize these images and make sure the size is less.
The problem with images is that as you compress these, there is also a reduction in quality, which you may not want.
When working with images, the best way to keep the size of your Excel file low is by compressing the images before you insert it into Excel.
A good online tool to do this is TinyPNG (or you can use Photoshop or any other similar tool).
It’s a free tool that can reduce the size of an image by up to 90% and still maintains decent image quality.
Below is the screenshot where I was able to compress an image with the size of 3.9 MB to 331 KB with minimal loss in quality.
Once you have uploaded these compressed images to Excel, you can further compress it using the inbuilt option in Excel.
Here are the steps to compress an image in Excel:
- Select the image that you want to compress.
- Click on the Picture Tools Format tab. This is a contextual tab that only appears when you click on a picture.
- In the Adjust group, click on ‘Compress Picture’ option.
- In the Compress Pictures dialog box:
- Deselect ‘Apply only to this picture’ if you want to compress all the images in the workbook.
- Select Email (96 ppi) for maximum compression.
- Click OK.
- Save the file.
This will compress all the images and help you reduce the file size of your Excel workbook.
Test Results:
I used the compress imge option in Excel using one image.
Below are the results:
By using the compress image option, file size reduced from 445 KB to 43 KB (
90% reduction in file size).
This would depend on the image as well. An image that is already compressed may not lead to a huge size reduction.
Remove Pivot Cache to Save Space
If you work with Pivot tables and struggle with large Excel files, knowing about Pivot cache can be useful.
When you create a pivot table using a data set, Excel automatically creates the Pivot Cache.
Pivot cache is an object that holds a replica of the data source.
While you can’t see it, it is a part of the workbook and is connected to the Pivot Table. When you make any changes in the Pivot Table, it does not use the data source, rather it uses the Pivot Cache.
While you think that you are directly linked to the source data, in reality, you access the pivot cache (and not the source data) when you make changes in the pivot table.
Now since you’re creating a replica of the data set, it takes some space.
So as soon as you create a Pivot table, you will notice that the size of the Excel file increase.
In the above example, as soon as I add the Pivot table, the size of the file increases two-fold.
Now, there are two ways you can reduce the file size when working with Pivot tables.
- Keep the source data and delete the Pivot Cache
- Keep the Pivot Cache and delete the source data
Let’s look at both these techniques.
Keep the Source Data and Delete Pivot Cache
When you’re done with the Pivot table and are saving it, you can force Excel to only save the source data and the resulting Pivot Table, and not the Pivot Cache.
Doing this will make your Excel file lighter, and you have a way to recreate the Pivot cache when you need it the next time.
Below is the difference in size when you save an Excel file with and without Pivot Cache.
Here are the steps to NOT save the Pivot Cache:
- Select any cell in the Pivot Table.
- Click the Analyze tab.
- Click on Pivot Table ‘Options’ icon.
- In the Pivot Table Options dialog box, click on Data tab.
- In the Pivot Table Data options, uncheck ‘Save source data with file’. This option ensures that the Pivot Cache is not saved when you save the workbook (and helps in reducing Excel file size).
- Check the option – ‘Refresh data when opening the file’. This option ensures that soon as you open the workbook, the Pivot Table is refreshed and the Pivot Cache is automatically generated. If you don’t check this option, you’ll have to refresh the Pivot table manually to generate the Pivot Cache.
- Click OK.
Now when you save the file with the Pivot table, you’ll notice a reduced file size.
Keep the Pivot Cache and Delete the Source Data
Another way reduce Excel file size is to delete the source data of a Pivot Table and keep the Pivot Cache only.
This works as a Pivot Cache is a mirror image of your data and you don’t access the source data when making changes to the Pivot Table, instead, you use the Pivot Cache.
Below is are results when I saved the Excel file without the source data.
To do this, just delete the data (either by deleting the data or the worksheet that has the data).
When you want to get the source data back, double-click on the ‘Grand Total’ cell of the Pivot table and it will instantly generate the entire data set in a new worksheet.
Compress the File (ZIP IT)
This is something you can do outside of the Excel application.
When you zip an Excel file, you’ll see a size reduction of about 10-15% immediately.
You can then share this zipped file to via email, and the person receiving this can unzip the file and use the Excel workbook.
Here are the steps to Zip an Excel file (for Windows):
- Right-click on the Excel File
- Hover your cursor on the Send to option.
- Click on the ‘Compressed (zipped) folder’ option.
This will create a zipped file for the selected Excel workbook.
You’ll also notice a reduction in file size (as shown below).
Test Results
With this technique, I was able to reduce the file size of the Excel workbook by 8%.
This technique works better for files that are in the 20-50 MB range. As the file size increases, the percentage reduction is not very high.
Remove Data formatting
Data formatting such as applying a background color, or adding borders, or changing font style can all add to the file size.
Although, based on my tests, I noticed that it doesn’t have a huge impact.
Below are the sizes of two Excel workbooks, one with 2.6 million data points (in one worksheet), and the other with the same data but formatting applied to it (cell color, border, and italicized).
Test Results
You can see the difference between the two files is not that huge (although it does make an impact when you have a lot of data).
The file with data is 14.6 MB and the file with data and formatting is 14.9 MB.
So if you want to reduce the file size of your Excel workbook, you can look for formatting you don’t need. Removing it can save you some disk space.
Here are the steps to instantly remove all the formatting, while keeping the data intact:
- Select the entire dataset (from which you want to remove formatting).
- Click the Home tab.
- In the Editing group, click on ‘Clear’.
- Click on ‘Clear Formats’.
- Save the workbook.
Remove Conditional formatting
Just like regular data formatting, conditional formatting also adds to the file size.
However, based on my tests, I noticed that the difference is less (unless you have multiple rules applied to multiple sheets with huge datasets).
Nevertheless, it’s a good idea to remove conditional formatting from any dataset where you don’t need it.
Apart from the size, there is another good reason to remove conditional formatting – SPEED.
Conditional formatting is volatile and whenever there is any change in the worksheet, it recalculates. This can lead to a slower workbook.
Test Results
I created a file with 27.2 million data points and applied 5 conditional formatting rules to it.
The difference in size seems to be only a few KBs.
Excel Performance Booster Tips
While the above methods will help you reduce Excel file size, here are some additional tips to improve the performance of Excel Workbooks:
- Avoid using volatile formulas. Apart from increasing the file size, volatile formulas also make you workbooks slow. Examples of volatile functions include RAND, TODAY, OFFSET, INDIRECT, etc.
- If you have a need to create summaries of a large dataset, instead of using formulas, see if you can use a Pivot Table instead. A Pivot table is fast and very intuitive as compared to formulas.
- If you extract data from multiple sources or combine data from multiple files, use Power Query to get and transform the data. You can save the data as a Power Query connection instead of keeping it in the worksheet. You can easily create Pivot Table using the connections created using Power Query.
- Convert your tabular data into an Excel table and use the Excel table in formulas. It makes your workbook perform faster and formulas created using Excel Table structured references are easier to manage (as these are more intuitive).
- Avoid referencing entire row or column in a formula. This will help your formulas be more efficient.
- If you have a lot of formulas in your workbook, turn off Automatic calculation and switch to manual calculation. By doing this, every time there is a change in the worksheets, the formulas wouldn’t recalculate. You can make this change by going to the Formula tab and changing the ‘Calculation Options’.
Hope you find the method and tips in this tutorial useful.
What else I could add to this tutorial to make it more useful? Please let me know in the comments section.
You May Also Like the Following Excel Tutorials:
Источник
Zip Files Using the Send To Menu
- Select the file(s) and/or folder(s) you want to compress.
- Right-click on the file or folder (or group of files or folders), then point to Send to and select Compressed (zipped) folder.
- Name the ZIP file.
Contents
- 1 How do I compress an Excel file to make it smaller?
- 2 How do I compress an Excel file to zip for free?
- 3 How do I reduce the size of an Excel file to email?
- 4 How do I compress an Excel file to email?
- 5 How do I compress an Excel file online?
- 6 How do I zip an Excel file in Windows 10?
- 7 Why is my Excel file size suddenly so large?
- 8 How do you find out what is slowing down an Excel spreadsheet?
- 9 What is considered a large Excel file?
- 10 How can I email a file larger than 25MB?
- 11 How do you send a large Excel file through Outlook?
- 12 How big can an Excel file be before it crashes?
- 13 Can an Excel file be compressed?
- 14 How do I make a zip file smaller to email?
- 15 How do I compress files into a zip file?
- 16 How do I compress a large file to make it smaller in Windows 10?
- 17 Why can I not compress a folder?
- 18 What is XML in Excel?
- 19 How do I create an XML schema?
- 20 How do reduce file size?
How do I compress an Excel file to make it smaller?
Directly reduce file size
- Remove “blank space” in your sheets.
- Check for and delete unnecessary hidden sheets.
- Save your files in binary format (.
- Remove formatting on raw data.
- Double check Conditional Formatting ranges.
- Disable automatic formula calculation.
- Use a Watch Window to always check on specific cells.
How do I compress an Excel file to zip for free?
How to convert xls to zip?
- Upload xls-file. Select xls file, which you want to convert, from your computer, Google Drive, Dropbox or drag and drop it on the page.
- Convert xls to zip. Select zip or any other format, which you want to convert.
- Download your zip-file.
How do I reduce the size of an Excel file to email?
Reduce the file size of your Excel spreadsheets
- Go to File > Options > Save.
- Under Save workbooks, in the Save files in this format list, select Excel Binary Workbook.
How do I compress an Excel file to email?
Compress the File (ZIP IT)
- Right-click on the Excel File.
- Hover your cursor on the Send to option.
- Click on the ‘Compressed (zipped) folder’ option.
How do I compress an Excel file online?
Upload your Excel spreadsheet and click on “Compress” button. You will get the download link as soon as the file is compressed. Powered by Aspose. Cells .
- Upload your Excel files to compress.
- Press the “COMPRESS” button.
- Download the compressed files instantly or send a download link to email.
How do I zip an Excel file in Windows 10?
How to zip files in Windows 10
- Put all the files you want to zip in the same location, like the same folder.
- Select all the files.
- Right-click one of the selected files.
- In the drop-down menu, choose Send to and then click Compressed (zipped) folder.
- A new zip file will appear in the same folder.
Why is my Excel file size suddenly so large?
Another reason for large file size is having many unused or hidden worksheets in your Workbook. Each Excel Worksheet has it’s own share of metadata, more importantly, however, you may be keeping sheets with similar datasets, copies or unnecessary Pivot Tables that also take up a lot of space.
How do you find out what is slowing down an Excel spreadsheet?
To find out if formatting is slowing down the file, make a copy of it and open the copy in Excel. Select the entire worksheet by pressing Ctrl-A. If the workbook has more than one worksheet, hold down Shift while you click the last tab at the bottom of the window so that you select all of the worksheets.
What is considered a large Excel file?
If your excel file is large (2 mb or larger) you will notice longer loading time, reduced performance, unresponsiveness, etc. All this can be avoided if you keep your file size reasonable.
How can I email a file larger than 25MB?
If you want to send a file larger than 25MB via email, than you can do so by using Google Drive. Once you’re logged into Gmail, click “compose” to create an email. Then, you’ll see a paperclip icon at the bottom of the email that indicates a file attachment.
How do you send a large Excel file through Outlook?
To send attachments via Large File Send from the Microsoft Outlook client :
- Create a Message.
- Click on the Mimecast tab.
- Click on the Attach Large Files icon.
- Select the Files you want to attach. Note:
- Click the Send button.
- Amend the Large File Send options as required: Note:
- Click on the Send button.
How big can an Excel file be before it crashes?
Maximum file size for rendering a workbook in Excel Services: 10 megabytes (MB) default. 2 gigabytes (GB) maximum (2)
Can an Excel file be compressed?
While building financial models, the Excel file size can be reduced by removing unnecessary data, formula, worksheet, formatting, and Pivot Cache. The Excel file size can be further compressed by saving the file in binary format or compressing it into a zip archive.
How do I make a zip file smaller to email?
Compress the file. You can make a large file a little smaller by compressing it into a zipped folder. In Windows, right-click the file or folder, go down to “send to,” and choose “Compressed (zipped) folder.” This will create a new folder that’s smaller than the original.
How do I compress files into a zip file?
To zip (compress) a file or folder
- Locate the file or folder that you want to zip.
- Press and hold (or right-click) the file or folder, select (or point to) Send to, and then select Compressed (zipped) folder. A new zipped folder with the same name is created in the same location.
How do I compress a large file to make it smaller in Windows 10?
Zip Files Using the Send To Menu
- Select the file(s) and/or folder(s) you want to compress.
- Right-click on the file or folder (or group of files or folders), then point to Send to and select Compressed (zipped) folder.
- Name the ZIP file.
Why can I not compress a folder?
If you can’t compress your files and folders, check the permissions settings for those items. If permissions aren’t correct, you might not be able to copy, move, or overwrite certain items. On your Mac, select the item, then choose File > Get Info, or press Command-I.
What is XML in Excel?
Excel has a defined XML schema that defines the contents of an Excel workbook, including XML tags that store all workbook information, such as data and properties, and define the overall structure of the workbook. Custom applications can use this Excel macro-enabled Office XML Format File.
How do I create an XML schema?
To create an XML schema file, complete the following steps.
Procedure
- Click File > New > Other. A window opens in which you can select a wizard.
- Expand XML, select XML Schema File, click Next. The Create XML Schema wizard opens.
- Select a parent folder and enter a file name for your XML schema file.
- Click Finish.
How do reduce file size?
Remove unnecessary images, formatting and macros. Save the file as a recent Word version. Reduce the file size of the images before they are added to the document. If it is still too large, save the file as a PDF.
If you have a file with an .xlsx extension on the file name that was last edited
by
Microsoft Excel, then the file is stored in an
Office
Open XML (OpenXML) zipped, XML-based file format developed by Microsoft for
spreadsheets, charts, presentations and word processing documents. You can
change the file extension to .zip by renaming the file. You should then
be able to extract the contents of the zip file as you would with any other
zip file.
There are different algorithms that can be used for storing files within a
zip file that determine the level of compression and speed of production of
a zip file. If you are using a
Linux or
Apple OS X
system, you can see choices that are available for compressing files and
directories into a zip file from the
command line, e.g. from a
Terminal
window on an OS X system, by looking at the
man page
for the zip program by
issuing the command man zip
. The
following options are available for file compression:
-Z cm --compression-method cm Set the default compression method. Currently the main methods supported by zip are store and deflate. Compression method can be set to: store - Setting the compression method to store forces zip to store entries with no compression. This is generally faster than compressing entries, but results in no space savings. This is the same as using -0 (compression level zero). deflate - This is the default method for zip. If zip determines that storing is better than deflation, the entry will be stored instead. bzip2 - If bzip2 support is compiled in, this compression method also becomes available. Only some modern unzips currently sup- port the bzip2 compression method, so test the unzip you will be using before relying on archives using this method (compression method 12). For example, to add bar.c to archive foo using bzip2 compres- sion: zip -Z bzip2 foo bar.c The compression method can be abbreviated: zip -Zb foo bar.c -# (-0, -1, -2, -3, -4, -5, -6, -7, -8, -9) Regulate the speed of compression using the specified digit #, where -0 indicates no compression (store all files), -1 indi- cates the fastest compression speed (less compression) and -9 indicates the slowest compression speed (optimal compression, ignores the suffix list). The default compression level is -6. Though still being worked, the intention is this setting will control compression speed for all compression methods. Cur- rently only deflation is controlled.
Excel uses the «deflate» storage method as can be seen for the following
Example.xlsx
file produced by Microsoft Excel for Mac 2011 on a
MacBook Pro laptop by using the
zipinfo command, which
lists detailed information about zip archives. The Example workbook has two
worksheets with the default names of sheet1
and
sheet2
.
$ zipinfo Example.xlsx Archive: Example.xlsx 32642 bytes 12 files -rw---- 4.5 fat 1356 b- defS 1-Jan-80 00:00 [Content_Types].xml -rw---- 4.5 fat 733 b- defS 1-Jan-80 00:00 _rels/.rels -rw---- 4.5 fat 839 b- defS 1-Jan-80 00:00 xl/_rels/workbook.xml.rels -rw---- 4.5 fat 805 b- defS 1-Jan-80 00:00 xl/workbook.xml -rw---- 4.5 fat 1055 b- defS 1-Jan-80 00:00 xl/styles.xml -rw---- 4.5 fat 1314 b- defS 1-Jan-80 00:00 xl/worksheets/sheet2.xml -rw---- 4.5 fat 7646 b- defS 1-Jan-80 00:00 xl/theme/theme1.xml -rw---- 4.5 fat 1206 b- defS 1-Jan-80 00:00 xl/worksheets/sheet1.xml -rw---- 4.5 fat 23468 b- stor 1-Jan-80 00:00 docProps/thumbnail.jpeg -rw---- 4.5 fat 454 b- defS 1-Jan-80 00:00 xl/sharedStrings.xml -rw---- 4.5 fat 872 b- defS 1-Jan-80 00:00 docProps/app.xml -rw---- 4.5 fat 755 b- defS 1-Jan-80 00:00 docProps/core.xml 12 files, 40503 bytes uncompressed, 29422 bytes compressed: 27.4% $
The «defS» in the sixth column indicates the compression method used.
There are six methods known at present: storing (no compression),
reducing, shrinking, imploding, tokenizing (never publicly released),
and deflating. In addition, there are four levels of reducing (1
through 4); four types of imploding (4K or 8K sliding dictionary,
and 2 or 3 Shannon-Fano trees); and four levels of deflating
(superfast, fast, normal, maximum compression). zipinfo represents
these methods and their sub-methods as follows: stor; re:1,
re:2, etc.; shrk; i4:2, i8:3,
etc.; tokn; and defS, defF,
defN, and defX.
If I rename the Example.xlsx
file to Example.zip
and extract its contents and then rezip the contents of the directory produced
when I extracted the contents of the zip file with the zip utility,
I see the following:
$ zip -r Example.zip Example/* adding: Example/[Content_Types].xml (deflated 74%) adding: Example/_rels/ (stored 0%) adding: Example/_rels/.rels (deflated 65%) adding: Example/docProps/ (stored 0%) adding: Example/docProps/app.xml (deflated 53%) adding: Example/docProps/core.xml (deflated 50%) adding: Example/docProps/thumbnail.jpeg (deflated 23%) adding: Example/xl/ (stored 0%) adding: Example/xl/_rels/ (stored 0%) adding: Example/xl/_rels/workbook.xml.rels (deflated 71%) adding: Example/xl/sharedStrings.xml (deflated 50%) adding: Example/xl/styles.xml (deflated 55%) adding: Example/xl/theme/ (stored 0%) adding: Example/xl/theme/theme1.xml (deflated 80%) adding: Example/xl/workbook.xml (deflated 42%) adding: Example/xl/worksheets/ (stored 0%) adding: Example/xl/worksheets/sheet1.xml (deflated 53%) adding: Example/xl/worksheets/sheet2.xml (deflated 54%) $
I.e., I see that, by default, the deflation method is being used for files.
If I then check the .zip file produced by the zip utility with the
zipinfo utility, I see «defN» listed in the sixth column for the
compression method.
$ zipinfo Example.zip Archive: Example.zip 26878 bytes 18 files -rwxr-xr-x 3.0 unx 1356 tx defN 1-Jan-80 00:00 Example/[Content_Types].xml drwxr-xr-x 3.0 unx 0 bx stor 13-Nov-16 15:37 Example/_rels/ -rwxr-xr-x 3.0 unx 733 tx defN 1-Jan-80 00:00 Example/_rels/.rels drwxr-xr-x 3.0 unx 0 bx stor 13-Nov-16 15:37 Example/docProps/ -rwxr-xr-x 3.0 unx 872 tx defN 1-Jan-80 00:00 Example/docProps/app.xml -rwxr-xr-x 3.0 unx 755 tx defN 1-Jan-80 00:00 Example/docProps/core.xml -rwxr-xr-x 3.0 unx 23468 bx defN 1-Jan-80 00:00 Example/docProps/thumbnail.jpeg drwxr-xr-x 3.0 unx 0 bx stor 13-Nov-16 15:37 Example/xl/ drwxr-xr-x 3.0 unx 0 bx stor 13-Nov-16 15:37 Example/xl/_rels/ -rwxr-xr-x 3.0 unx 839 tx defN 1-Jan-80 00:00 Example/xl/_rels/workbook.xml.rels -rwxr-xr-x 3.0 unx 454 tx defN 1-Jan-80 00:00 Example/xl/sharedStrings.xml -rwxr-xr-x 3.0 unx 1055 tx defN 1-Jan-80 00:00 Example/xl/styles.xml drwxr-xr-x 3.0 unx 0 bx stor 13-Nov-16 15:37 Example/xl/theme/ -rwxr-xr-x 3.0 unx 7646 tx defN 1-Jan-80 00:00 Example/xl/theme/theme1.xml -rwxr-xr-x 3.0 unx 805 tx defN 1-Jan-80 00:00 Example/xl/workbook.xml drwxr-xr-x 3.0 unx 0 bx stor 13-Nov-16 15:37 Example/xl/worksheets/ -rwxr-xr-x 3.0 unx 1206 tx defN 1-Jan-80 00:00 Example/xl/worksheets/sheet1.xml -rwxr-xr-x 3.0 unx 1314 tx defN 1-Jan-80 00:00 Example/xl/worksheets/sheet2.xml
Deflation is the default compression method, but using the
zip utility on an OS X
system I can specify the level of reducing to be 1
using
-Z deflate -1
. I then see the compression method listed as
«defF».
$ zip -r -Z deflate -1 Example.zip Example/* adding: Example/[Content_Types].xml (deflated 73%) adding: Example/_rels/ (stored 0%) adding: Example/_rels/.rels (deflated 64%) adding: Example/docProps/ (stored 0%) adding: Example/docProps/app.xml (deflated 52%) adding: Example/docProps/core.xml (deflated 48%) adding: Example/docProps/thumbnail.jpeg (deflated 22%) adding: Example/xl/ (stored 0%) adding: Example/xl/_rels/ (stored 0%) adding: Example/xl/_rels/workbook.xml.rels (deflated 71%) adding: Example/xl/sharedStrings.xml (deflated 49%) adding: Example/xl/styles.xml (deflated 54%) adding: Example/xl/theme/ (stored 0%) adding: Example/xl/theme/theme1.xml (deflated 76%) adding: Example/xl/workbook.xml (deflated 41%) adding: Example/xl/worksheets/ (stored 0%) adding: Example/xl/worksheets/sheet1.xml (deflated 52%) adding: Example/xl/worksheets/sheet2.xml (deflated 51%) $ zipinfo Example.zip Archive: Example.zip 27389 bytes 18 files -rwxr-xr-x 3.0 unx 1356 tx defF 1-Jan-80 00:00 Example/[Content_Types].xml drwxr-xr-x 3.0 unx 0 bx stor 13-Nov-16 15:37 Example/_rels/ -rwxr-xr-x 3.0 unx 733 tx defF 1-Jan-80 00:00 Example/_rels/.rels drwxr-xr-x 3.0 unx 0 bx stor 13-Nov-16 15:37 Example/docProps/ -rwxr-xr-x 3.0 unx 872 tx defF 1-Jan-80 00:00 Example/docProps/app.xml -rwxr-xr-x 3.0 unx 755 tx defF 1-Jan-80 00:00 Example/docProps/core.xml -rwxr-xr-x 3.0 unx 23468 bx defF 1-Jan-80 00:00 Example/docProps/thumbnail.jpeg drwxr-xr-x 3.0 unx 0 bx stor 13-Nov-16 15:37 Example/xl/ drwxr-xr-x 3.0 unx 0 bx stor 13-Nov-16 15:37 Example/xl/_rels/ -rwxr-xr-x 3.0 unx 839 tx defF 1-Jan-80 00:00 Example/xl/_rels/workbook.xml.rels -rwxr-xr-x 3.0 unx 454 tx defF 1-Jan-80 00:00 Example/xl/sharedStrings.xml -rwxr-xr-x 3.0 unx 1055 tx defF 1-Jan-80 00:00 Example/xl/styles.xml drwxr-xr-x 3.0 unx 0 bx stor 13-Nov-16 15:37 Example/xl/theme/ -rwxr-xr-x 3.0 unx 7646 tx defF 1-Jan-80 00:00 Example/xl/theme/theme1.xml -rwxr-xr-x 3.0 unx 805 tx defF 1-Jan-80 00:00 Example/xl/workbook.xml drwxr-xr-x 3.0 unx 0 bx stor 13-Nov-16 15:37 Example/xl/worksheets/ -rwxr-xr-x 3.0 unx 1206 tx defF 1-Jan-80 00:00 Example/xl/worksheets/sheet1.xml -rwxr-xr-x 3.0 unx 1314 tx defF 1-Jan-80 00:00 Example/xl/worksheets/sheet2.xml 18 files, 40503 bytes uncompressed, 24221 bytes compressed: 40.2% $
Using -2
for the level of delation also results in the
deflation method shown by zipinfo being «defF». If -3
is
used, «defN» is shown; «defN» is also shown by zipinfo if
-4
is used as an
argument to the zip command. If I issue the command
zip -r -n Example.zip Example/*
, where n is a
number between 0 and 9, on an OS X system, I see the following methods listed
when I check the resulting zip file with zipinfo.
Number | Method | |
---|---|---|
0 | stor | |
1 | defF | |
2 | defF | |
3 | defN | |
4 | defN | |
5 | defN | |
6 | defN | |
7 | defN | |
8 | defX | |
9 | defX |
You might expect that you could recompress the folder where the files
were extracted to produce a new zip file and then rename that to be a .xlsx
file which you could then open with Excel. That won’t work, however. If you
right click on the directory containing the extracted files from the
Finder application and choose Compress dirname where
dirname is the relevant directory name, that will produce a new zip
file. E.g., if the file you started from was Example.xls
and you
renamed it to Example.zip
and then extracted the contents of the
zip file to the directory Example
, you would now have a
Example.zip
file again. You can right-click on it and rename the
extension back to .xlsx, but if you try to open that file with Excel you will
see the message «file format is not valid». You will also have the same problem
if you use the command line zip
program, e.g., if you used zip -r Example.zip Example/*
.
The zip file produced by those methods on an Apple OS X system does
not match what Excel is expecting.
If you create a zip file with the
Python
zipfile
module, the deflate method is used by default and you will see
«defN», if you check the zip file created with that module. You can
create a zip file of a directory from the command line with that
module using the command python -m zipfile -c zipfilename
where zipfilename is the name you
directory
wish to give to the zip file and directory is the directory
you wish to compress into a zip file. E.g., python -m zipfile
. You will also not be able to open the zip file
-c Example.zip Example/
produced by that method with Excel by simply renaming the file to have a .xlsx
rather than a .zip extension. You will again get the «file format is not
valid» message, if you try to open the file in Excel.
However, if you use the Python
shutil module to
create the zip file from the directory and then rename the zip file to a .xlsx
file, you can open it in Excel. The
zipdir.py Python script can be
used to create a zip file that can be opened with Excel after changing the file
extension.
I noticed that when I produce zip files from a directory on an OS X system
using methods other than with the Python shutil module, that the directories
are shown with the «stor» compression method. I.e., they are stored with no
compression employed. When I compress the directory with
zipdir.py
E.g., zipinfo shows the following information for a zip file produced
by python -m zipfile -c Example.zip Example/
:
$ zipinfo Example.zip Archive: Example.zip 26101 bytes 19 files drwx------ 2.0 unx 0 b- stor 13-Nov-16 15:37 Example/ -rwxr-xr-x 2.0 unx 1356 b- defN 1-Jan-80 00:00 Example/[Content_Types].xml drwxr-xr-x 2.0 unx 0 b- stor 13-Nov-16 15:37 Example/_rels/ -rwxr-xr-x 2.0 unx 733 b- defN 1-Jan-80 00:00 Example/_rels/.rels drwxr-xr-x 2.0 unx 0 b- stor 13-Nov-16 15:37 Example/docProps/ -rwxr-xr-x 2.0 unx 872 b- defN 1-Jan-80 00:00 Example/docProps/app.xml -rwxr-xr-x 2.0 unx 755 b- defN 1-Jan-80 00:00 Example/docProps/core.xml -rwxr-xr-x 2.0 unx 23468 b- defN 1-Jan-80 00:00 Example/docProps/thumbnail.jpeg drwxr-xr-x 2.0 unx 0 b- stor 13-Nov-16 15:37 Example/xl/ drwxr-xr-x 2.0 unx 0 b- stor 13-Nov-16 15:37 Example/xl/_rels/ -rwxr-xr-x 2.0 unx 839 b- defN 1-Jan-80 00:00 Example/xl/_rels/workbook.xml.rels -rwxr-xr-x 2.0 unx 454 b- defN 1-Jan-80 00:00 Example/xl/sharedStrings.xml -rwxr-xr-x 2.0 unx 1055 b- defN 1-Jan-80 00:00 Example/xl/styles.xml drwxr-xr-x 2.0 unx 0 b- stor 13-Nov-16 15:37 Example/xl/theme/ -rwxr-xr-x 2.0 unx 7646 b- defN 1-Jan-80 00:00 Example/xl/theme/theme1.xml -rwxr-xr-x 2.0 unx 805 b- defN 1-Jan-80 00:00 Example/xl/workbook.xml drwxr-xr-x 2.0 unx 0 b- stor 13-Nov-16 15:37 Example/xl/worksheets/ -rwxr-xr-x 2.0 unx 1206 b- defN 1-Jan-80 00:00 Example/xl/worksheets/sheet1.xml -rwxr-xr-x 2.0 unx 1314 b- defN 1-Jan-80 00:00 Example/xl/worksheets/sheet2.xml 19 files, 40503 bytes uncompressed, 23777 bytes compressed: 41.3% $
But the same directory when compressed by zipdir.py
with the
Python shutil module into a zip file produces a zip file for which zipinfo
shows the following information:
$ zipinfo example.zip Archive: example.zip 25165 bytes 12 files -rwxr-xr-x 2.0 unx 1356 b- defN 1-Jan-80 00:00 [Content_Types].xml -rwxr-xr-x 2.0 unx 733 b- defN 1-Jan-80 00:00 _rels/.rels -rwxr-xr-x 2.0 unx 872 b- defN 1-Jan-80 00:00 docProps/app.xml -rwxr-xr-x 2.0 unx 755 b- defN 1-Jan-80 00:00 docProps/core.xml -rwxr-xr-x 2.0 unx 23468 b- defN 1-Jan-80 00:00 docProps/thumbnail.jpeg -rwxr-xr-x 2.0 unx 454 b- defN 1-Jan-80 00:00 xl/sharedStrings.xml -rwxr-xr-x 2.0 unx 1055 b- defN 1-Jan-80 00:00 xl/styles.xml -rwxr-xr-x 2.0 unx 805 b- defN 1-Jan-80 00:00 xl/workbook.xml -rwxr-xr-x 2.0 unx 839 b- defN 1-Jan-80 00:00 xl/_rels/workbook.xml.rels -rwxr-xr-x 2.0 unx 7646 b- defN 1-Jan-80 00:00 xl/theme/theme1.xml -rwxr-xr-x 2.0 unx 1206 b- defN 1-Jan-80 00:00 xl/worksheets/sheet1.xml -rwxr-xr-x 2.0 unx 1314 b- defN 1-Jan-80 00:00 xl/worksheets/sheet2.xml 12 files, 40503 bytes uncompressed, 23777 bytes compressed: 41.3% $
So, perhaps, the issue is caused by the directory information being «stored»
rather than deflation being used.
Note: testing done on a MacBook Pro laptop running
OS X
Yosemite (10.10.5) using
Microsoft Office for Mac 2011.
Download Article
Download Article
Is your Excel file too big? If you need to send a large Excel file to another person, you can easily compress the file into a ZIP file. The recipient can later unzip the file without sacrificing the quality. This wikiHow will show you how to compress and zip an Excel file to send via email, USB, or more.
-
1
Open the file location of the Excel file.
-
2
Right click on the Excel file you wanted to zip. A pop-up menu will appear.
Advertisement
-
3
Select Send to, and then Compressed (zipped) folder.
-
4
Change the name of the .zip file (optional) and press ↵ Enter to finish.
Advertisement
Ask a Question
200 characters left
Include your email address to get a message when this question is answered.
Submit
Advertisement
-
You can highlight files to compress or zip them all in one zip file.
Thanks for submitting a tip for review!
Advertisement
About This Article
Thanks to all authors for creating a page that has been read 71,764 times.
Is this article up to date?
Excel workbooks have been known to become painfully slow and heavy as more data/formulas/images are added to it.
Sometimes, it’s easy to get rid of the extra flab and keep the excel file size in check, and sometimes, it isn’t.
And since Excel is not a web-based tool, most of us work and collaborate by sending Excel files via email. And a large Excel file that weighs 50 MB can be hard to share with your colleagues/clients.
In my last job, we used Lotus Notes email client, which is snail-slow, and sending heavy Excel files over that was torture.
While there is no magical way to reduce the size of an Excel workbook, there are a few techniques that you can use to cut down some flab.
Note: The impact of these techniques to reduce Excel file size would depend on your data. For some, it may help reduce the size by 50% and for some, it may only end up reducing the size by 5%.
Tips to Reduce Excel File Size
Below are the techniques you can use to reduce the file size of your Excel workbook.
For each tip, I have done some testing and have added the snapshots to show you the impact on file size. The results you get would vary depending upon your data and files.
Based on your workbook, you can use one or more of these tips.
Remove Unnecessary Worksheets/Data
The best solutions are often the easiest ones.
And this technique is more of common sense and less of any Excel wizardry.
If you have an Excel workbook that has some worksheets that are not needed (and are not being used in any formulas), see if you can get rid of those.
This has a direct correlation with the Excel file size. So as soon as you delete some of the worksheets and save the workbook, you will instantly see a reduced file size.
Test Results:
I created an Excel file with 10 worksheets where each worksheet has 2.6 million data points (26 columns with 100,000 data points in each column).
The resulting size of this workbook is 143 MB (and it’s taking quite some time to save and open).
Now when I deleted five sheets, the size reduced by half (duh).
As you can see, data that you have your worksheet has a direct correlation with the file size.
Convert to Binary Format (XLSB)
Do you know that just by saving an Excel file in the XLSB format can reduce the file size?
Yes, it’s true.
All you have to do is while saving a workbook, use the .xlsb format.
Here are the steps to do this:
- Click the File tab.
- Click on Save As.
- Click on Browse.
- In the Save As dialog box, change the file type to Excel Binary Workbook (.xlsb)
Test Results
I had an Excel workbook that took 14.6 MB of space.
After converting the same file to the XLSB format, I was able to reduce the size to 10.4 MB (a size reduction of ~28%).
What is XLSB?
When you save an Excel file (.xlsx or .xlsm), it gets saved in the XML format.
For example, if I change the file extension of the XLSX file to ZIP and then open it, this is what I get.
And if I further go in the ‘xl’ folder and then go in the worksheet folder, it shows me the worksheets in that workbook (and these worksheets are saved as an XML document).
Now let’s do the same with an XLSB file.
So I first change the file extension to ZIP, then open it and locate sheet1. Here is what you get:
You’ll notice that both XLSX and XLSB saves the worksheet in a different format.
XLSX/XLSM saves it as an XML file and XLSB saves it as a binary (.bin) file.
And without getting too technical, XML files are large in size as compared to a binary file.
So when you save your Excel workbook in the XLSB format, the file size is reduced. In our above example, the size reduction was ~30%.
XLSB Vs XLSX/XLSM
When it comes to using the XLSB format, size reduction is a huge benefit. But you need to be a bit cautious when working with the XLSB format.
Advantages of XLSB format:
- It reduces the Excel file size. This can be helpful when you have large files and you want to share it over email. You can quickly reduce the size by saving it in XLSB.
- XLSB files tend to open and save faster than XML file. Based on the limited tests I did, XLSB files were opening and saving 25%-50% faster. This difference is noticeable in large Excel files only. With smaller files, both XLSB and XLSX are fast.
While XLSB looks great, there are a few reasons you should stick to using XLSX/XLSM files:
- With XLSB format, you have no way of knowing whether it has a macro or not. This makes it riskier as someone can use it to execute malicious code.
- XLSB files are encoded in proprietary bin file format while XML is an open-source readable file format. This means that if you’re using third-party tools with Excel, it’s better to use XML format.
- Power Query cannot read data from an XLSB file. So if you use Power Query, it’s better to have your data in XLSX/XLSM formats.
As a general rule, if your file size is small (less than 5 MB), it’s better to stick to XLSX/XLSM formats.
Based on what I heard from people and read on many forums, a lot of people prefer to use XLSB as the file format when it comes to using Excel.
Here is a good article on understanding the XLSB format.
Remove Unnecessary Formulas
Too many formulas will bloat your workbook file size.
So if you have a data set that you need, but don’t need the formulas in it, it’s better to convert these formulas into values.
Here are the steps to quickly convert formulas to values in Excel:
- Select the entire worksheet/dataset.
- Press the F5 key.
- In the Go To dialog box, click on ‘Special’.
- In the Go To Special dialog box, select Formulas.
- Click OK.
The above steps would select all the cells that have a formula in it.
Now use the below steps to convert these formulas into values:
- Copy the selected cells (control + C)
- Click the Home tab.
- In the Clipboard group, click on Paste.
- Click on Paste Value icon.
The above steps would convert all the cells with formulas into values.
Test Results
I created an Excel file with 2.7 million data points (1048576*26) and then added three columns with formulas (SUM, COUNT and AVERAGE).
Then I converted these formulas into values and saved the file with a different name.
Below is the result:
The file with no formulas is ~8% less in size (and note that I only had 3 columns of formulas).
In case you have a lot of formulas, it can add to the size.
NOTE: Volatile formulas can really bloat your file size. As a part of the test, when I replaced the SUM formula with a volatile formula (OFFSET), it lead to a jump in the file size (from 186 MB to 198 MB). So if you have volatile formulas that you can replace with non-volatile formulas, or can convert these into values, it will help you reduce the file size.
Compress Images (Before and After Uploading)
If you work with Excel files that have images in it, you need to optimize these images and make sure the size is less.
The problem with images is that as you compress these, there is also a reduction in quality, which you may not want.
When working with images, the best way to keep the size of your Excel file low is by compressing the images before you insert it into Excel.
A good online tool to do this is TinyPNG (or you can use Photoshop or any other similar tool).
It’s a free tool that can reduce the size of an image by up to 90% and still maintains decent image quality.
Below is the screenshot where I was able to compress an image with the size of 3.9 MB to 331 KB with minimal loss in quality.
Once you have uploaded these compressed images to Excel, you can further compress it using the inbuilt option in Excel.
Here are the steps to compress an image in Excel:
- Select the image that you want to compress.
- Click on the Picture Tools Format tab. This is a contextual tab that only appears when you click on a picture.
- In the Adjust group, click on ‘Compress Picture’ option.
- In the Compress Pictures dialog box:
- Deselect ‘Apply only to this picture’ if you want to compress all the images in the workbook.
- Select Email (96 ppi) for maximum compression.
- Click OK.
- Save the file.
This will compress all the images and help you reduce the file size of your Excel workbook.
Test Results:
I used the compress imge option in Excel using one image.
Below are the results:
By using the compress image option, file size reduced from 445 KB to 43 KB (~90% reduction in file size).
This would depend on the image as well. An image that is already compressed may not lead to a huge size reduction.
Remove Pivot Cache to Save Space
If you work with Pivot tables and struggle with large Excel files, knowing about Pivot cache can be useful.
When you create a pivot table using a data set, Excel automatically creates the Pivot Cache.
Pivot cache is an object that holds a replica of the data source.
While you can’t see it, it is a part of the workbook and is connected to the Pivot Table. When you make any changes in the Pivot Table, it does not use the data source, rather it uses the Pivot Cache.
While you think that you are directly linked to the source data, in reality, you access the pivot cache (and not the source data) when you make changes in the pivot table.
Now since you’re creating a replica of the data set, it takes some space.
So as soon as you create a Pivot table, you will notice that the size of the Excel file increase.
In the above example, as soon as I add the Pivot table, the size of the file increases two-fold.
Now, there are two ways you can reduce the file size when working with Pivot tables.
- Keep the source data and delete the Pivot Cache
- Keep the Pivot Cache and delete the source data
Let’s look at both these techniques.
Keep the Source Data and Delete Pivot Cache
When you’re done with the Pivot table and are saving it, you can force Excel to only save the source data and the resulting Pivot Table, and not the Pivot Cache.
Doing this will make your Excel file lighter, and you have a way to recreate the Pivot cache when you need it the next time.
Below is the difference in size when you save an Excel file with and without Pivot Cache.
Here are the steps to NOT save the Pivot Cache:
- Select any cell in the Pivot Table.
- Click the Analyze tab.
- Click on Pivot Table ‘Options’ icon.
- In the Pivot Table Options dialog box, click on Data tab.
- In the Pivot Table Data options, uncheck ‘Save source data with file’. This option ensures that the Pivot Cache is not saved when you save the workbook (and helps in reducing Excel file size).
- Check the option – ‘Refresh data when opening the file’. This option ensures that soon as you open the workbook, the Pivot Table is refreshed and the Pivot Cache is automatically generated. If you don’t check this option, you’ll have to refresh the Pivot table manually to generate the Pivot Cache.
- Click OK.
Now when you save the file with the Pivot table, you’ll notice a reduced file size.
Keep the Pivot Cache and Delete the Source Data
Another way reduce Excel file size is to delete the source data of a Pivot Table and keep the Pivot Cache only.
This works as a Pivot Cache is a mirror image of your data and you don’t access the source data when making changes to the Pivot Table, instead, you use the Pivot Cache.
Below is are results when I saved the Excel file without the source data.
To do this, just delete the data (either by deleting the data or the worksheet that has the data).
When you want to get the source data back, double-click on the ‘Grand Total’ cell of the Pivot table and it will instantly generate the entire data set in a new worksheet.
Compress the File (ZIP IT)
This is something you can do outside of the Excel application.
When you zip an Excel file, you’ll see a size reduction of about 10-15% immediately.
You can then share this zipped file to via email, and the person receiving this can unzip the file and use the Excel workbook.
Here are the steps to Zip an Excel file (for Windows):
- Right-click on the Excel File
- Hover your cursor on the Send to option.
- Click on the ‘Compressed (zipped) folder’ option.
This will create a zipped file for the selected Excel workbook.
You’ll also notice a reduction in file size (as shown below).
Test Results
With this technique, I was able to reduce the file size of the Excel workbook by 8%.
This technique works better for files that are in the 20-50 MB range. As the file size increases, the percentage reduction is not very high.
Remove Data formatting
Data formatting such as applying a background color, or adding borders, or changing font style can all add to the file size.
Although, based on my tests, I noticed that it doesn’t have a huge impact.
Below are the sizes of two Excel workbooks, one with 2.6 million data points (in one worksheet), and the other with the same data but formatting applied to it (cell color, border, and italicized).
Test Results
You can see the difference between the two files is not that huge (although it does make an impact when you have a lot of data).
The file with data is 14.6 MB and the file with data and formatting is 14.9 MB.
So if you want to reduce the file size of your Excel workbook, you can look for formatting you don’t need. Removing it can save you some disk space.
Here are the steps to instantly remove all the formatting, while keeping the data intact:
- Select the entire dataset (from which you want to remove formatting).
- Click the Home tab.
- In the Editing group, click on ‘Clear’.
- Click on ‘Clear Formats’.
- Save the workbook.
Remove Conditional formatting
Just like regular data formatting, conditional formatting also adds to the file size.
However, based on my tests, I noticed that the difference is less (unless you have multiple rules applied to multiple sheets with huge datasets).
Nevertheless, it’s a good idea to remove conditional formatting from any dataset where you don’t need it.
Apart from the size, there is another good reason to remove conditional formatting – SPEED.
Conditional formatting is volatile and whenever there is any change in the worksheet, it recalculates. This can lead to a slower workbook.
Test Results
I created a file with 27.2 million data points and applied 5 conditional formatting rules to it.
The difference in size seems to be only a few KBs.
Also Read: Tips to Make Slow Excel Spreadsheets Fast
Excel Performance Booster Tips
While the above methods will help you reduce Excel file size, here are some additional tips to improve the performance of Excel Workbooks:
- Avoid using volatile formulas. Apart from increasing the file size, volatile formulas also make you workbooks slow. Examples of volatile functions include RAND, TODAY, OFFSET, INDIRECT, etc.
- If you have a need to create summaries of a large dataset, instead of using formulas, see if you can use a Pivot Table instead. A Pivot table is fast and very intuitive as compared to formulas.
- If you extract data from multiple sources or combine data from multiple files, use Power Query to get and transform the data. You can save the data as a Power Query connection instead of keeping it in the worksheet. You can easily create Pivot Table using the connections created using Power Query.
- Convert your tabular data into an Excel table and use the Excel table in formulas. It makes your workbook perform faster and formulas created using Excel Table structured references are easier to manage (as these are more intuitive).
- Avoid referencing entire row or column in a formula. This will help your formulas be more efficient.
- If you have a lot of formulas in your workbook, turn off Automatic calculation and switch to manual calculation. By doing this, every time there is a change in the worksheets, the formulas wouldn’t recalculate. You can make this change by going to the Formula tab and changing the ‘Calculation Options’.
Hope you find the method and tips in this tutorial useful.
What else I could add to this tutorial to make it more useful? Please let me know in the comments section.
You May Also Like the Following Excel Tutorials:
- How to Recover Unsaved Excel Files.
- 100+ Excel Interview Questions.
- Best Excel Books (to Level up your Excel Skills).
- 200+ Excel Keyboard Shortcuts.
- 10 Ways to Clean Data in Excel.
- How to Turn On AutoSave in Excel