When should you use xlsm or xlsb formats?

Starting with Excel 2007, Microsoft has divided the classic .xls format into several formats (in particular, .xlsx , .xlsm , .xlsb ). I have no problem understanding the use and purpose of the .xlsx format, but I'm still wondering if I should use the .xlsm or .xlsb when creating a file containing some VBA.

Of course, you can find some topics on the Internet, for example:

From this last link, I realized that .xlsm is some kind of XML format and, therefore, is necessary for the custom ribbon tab.

Besides the conceptual difference between the format ( .xlsm based on XML VS .xlsb is a binary file), is there any practical difference when using any of this file (except for setting the tape)?
Have you ever seen any real difference when using any of these formats?

+97
excel excel-2007 xlsm xlsb
Oct 19 '11 at 12:55
source share
6 answers

All of them are similar in that they are essentially zip files containing the actual file components. You can see the content by simply replacing the extension with .zip and opening it. The difference with xlsb is that the components are not based on XML, but are presented in binary format: presumably, this is useful when working with large files.

https://blogs.msdn.microsoft.com/dmahugh/2006/08/22/new-binary-file-format-for-spreadsheets/

+60
Oct 19 '11 at 15:03
source share

.xlsx loads 4 times longer than .xlsb saves 2 times longer and has a 1.5 times larger file. I checked this on the generated worksheet with 10,000 rows * 1,000 columns = 10,000,000 (10 ^ 7) cells of simple chains =โ€ฆ+1 formulas:

 โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฅโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ โ”‚ โ•‘ .xlsx โ”‚ .xlsb โ”‚ โ•žโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•ฌโ•โ•โ•โ•โ•โ•โ•โ•โ•ชโ•โ•โ•โ•โ•โ•โ•โ•โ•ก โ”‚ loading time โ•‘ 165s โ”‚ 43s โ”‚ โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ซโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค โ”‚ saving time โ•‘ 115s โ”‚ 61s โ”‚ โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ซโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค โ”‚ file size โ•‘ 91 MB โ”‚ 65 MB โ”‚ โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•จโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ 

(Hardware: Core2Duo 2.3 GHz, 4 GB of RAM, 5.400 rpm SATA II HD; Windows 7, with a slightly heavy load from other processes.)

In addition, there should be no difference. More precisely,

both formats support the same set of functions

cites this blog post from 2006-08-29. So perhaps the information that .xlsb does not support the feed code is newer than the top quote, but I suppose your forum source is simply incorrect. When hacking a binary file, it seems that it succinctly imitates the OOXML 1-to-1 file structure: blog article 2006-08-07

+83
Mar 10 '12 at 1:13
source share

You might think that xlsb has only advantages over xlsm. The fact that xlsm is XML-based and xlsb is binary is that when you break a workbook, you have a better chance of recovering xlsm than xlsb.

+9
Nov 29 '15 at 16:40
source share

Just for posterity, here is text from several external sources regarding Excel file formats. Some of them were mentioned in other answers to this question, but without reproducing the main content.

1. From Doug Mahuga, August 22, 2006 :

... the new binary format is XLSB. Like Open XML, this is a full-featured file format in which you can store everything you can create in Excel, but the XLSB format is optimized to improve performance in ways that are impossible in a pure XML format.

The XLSB format (also sometimes referred to as BIFF12, as in the "binary file format for Office 12") uses the same open-packaging convention used by the Open XML and XPS formats. Thus, it is basically a ZIP container, and you can open it with any ZIP tool to see what's inside. But instead of .XML parts in the package, you will find .BIN parts ...

This article also refers to documentation about the BIN format , which is too long to reproduce here.

2. From the MSDN archive, August 29, 2006, which, in turn, cites an already missing blog post about the XLSB format:

Although we have done a great job to ensure that our XML formats are quickly and efficiently opened, this binary format is still more efficient for opening and saving in Excel and may lead to some performance improvements for workbooks that contain a lot of data, or it would require a lot of XML parsing during the Open process. (In fact, we found that the new binary format is in many cases faster than the old XLS format.) In addition, there is no version of this format without macros - all XLSB files can contain macros (VBA and XLM). Otherwise, it is functionally equivalent to the XML file format above:

File size โ€” the file size of both formats is approximately the same, because both formats are saved to disk using the zip compression architecture โ€” both formats use the same packaging structure, and both have the same part-level structures. Function support - both formats support the same set of functions Performance at runtime - after loading into memory, the file format does not affect the application / calculation conversion speed - both formats will have the same converter support

+6
Apr 03 '17 at 18:32
source share

The XLSB format is also intended for macros placed in a hidden workbook file located in the excel startup folder (XLSTART).

Quick and dirty test with xlsm or xlsb in the XLSTART folder:

 Measure-Command { $x = New-Object -com Excel.Application ;$x.Visible = $True ; $x.Quit() } 

0.89 with xlsb (binary) and 1.3s with the same content in xlsm format (xml in zip file) ... :)

+5
Jan 26 '15 at 5:31 on
source share

For some reason, using .xlsb over .xlsm solved some of the problems we had with a user-defined function that creates phantom objects in the object model: https://superuser.com/questions/1005482/excel-creates-non-existent-worksheets -in-vba-project-explorer / 1215336 # 1215336

0
Jun 02 '17 at 10:30
source share



All Articles