How to Reduce a Large Excel File
Excel 2013 and earlier versions like Excel 2007 and 2010 or later versions like 2016 is a great tool for data analysis but can grow in size quickly. Another problem is when you are connected to a database and you reduce the size of a query in the database view; the reduction in data is not reflected in Excel as the latter keeps an internal table of the data, especially when working with Pivot Tables that are linked to the database.
There are several techniques that you can use to reduce the size of an overbloated Excel file that I will review in this reference article.
Excel copies and stores data for each worksheet that is created in an Excel workbook. Even if you use external data from another spreadsheet or database, each sheet will have a copy of the data. You should review the different worksheets in a workbook to see if some can be deleted or combined to reduce space.
Eliminating excess worksheet, thus data bloat, will greatly reduce the size of your file and increase performance. Also be careful about links to other worksheets with a lot of formulas or to other worksheets in external workbooks. While this won't necessarily change the size of the workbook, it will impact performance which can be as problematic as bloated data.
Converting to Binary
Another technique that can substantially reduce the size can be used in conjunction the previous technique of consolidating and deleting old worksheets is to convert the Excel file to a binary format which is represented by the file extension xlsb. You won’t lose any functionality and you will actually gain some performance.
To convert a 2007, 2010, 2013, 2016 or greater Excel file to a binary format, follow these simple steps.
- With the Excel file open
- Click on the File tab (Fig 1)
- Select “Save AS” from the Tab menu
- In the Save As dialog select the “Save As Type” dropdown field and select the “Excel Binary Workbook (*.xlsb)” option from the list of values. See figure 2.
- Click Save
You'll notice a huge size file savings and an increase in performance by using the binary format. However, the trade off you won’t have access to the XML files in the Xlsx archive. See Figure 3.
Compacting Excel File
While not directly related to Excel, Windows has a feature that will compact the size of a file, including Excel.
To compact your Excel file, locate the your file via Windows Explorer
- Right click the file
- Select Properties from the context menu
- Next Select the Advanced button (see Figure 4 below)
- Finally select “ compress contents to save disk space...”
Storing the data in PowerQuery
A feature that was introduced in Excel 2007 is the PowerPivot and eventually the PowerQuery. With 2007 and 2010 versions of Excel, you can/could download a free download software/plugin for Excel that is called PowerPivot. In 2013, this technology become integrated in Excel and as of Excel 2016, it is called Get & Transform.
Where you can store up to 1 millions rows in a worksheet in Excel 2007 or 2010 (I wouldn't advise you tor try otherwise you will start getting "no resources available..." error messages), it was and still is unpractical because of performance degradation, instead you can store you data in PowerPivot which can easily handle up to 100 million rows without breaking a sweat. PowerPivot uses an API to create a tabular dataset the same way that SQL Server Analysis Services uses Tabular Data Models instead of OLAP and Power BI as well.
You import the data into PowerPivot the same way you do with Excel. You can also use DAX and PowerQuery Language to transform your data before using it in Excel. Once you data is ready, click on the Excel button in the PowerPivot menu and return to Excel. You data will be visible in Excel and you can work with like any other data in in Excel, except that data will actually in the PowerPivot and you will be accessing the data via a MetaData API. This is very powerful for data wrangling and data analysis.
These techniques can be used separately or together to help you reduce the file size of your Excel files.
For extra tips for working with large data sets in Excel, read my latest article:
- 10 Tips for Working With Large Excel Files
In our world of advanced analytics and big data, there is no getting away from our beloved data crunching and wrangling tool: Excel. However, with large datasets, Excel starts to huff and puff. These 10 tips will help crunch your data for the last mi
This article is accurate and true to the best of the author’s knowledge. Content is for informational or entertainment purposes only and does not substitute for personal counsel or professional advice in business, financial, legal, or technical matters.