Introduction
.xls is the extension of
Microsoft Excel’s binary
workbooks, the default format until Excel 2007 replaced it with
XLSX. The format is called BIFF, the Binary
Interchange File Format: a sequence of records, each a type, a length and data.
Each major Excel version changed BIFF. Excel 2.x, 3.0 and 4.0 wrote BIFF2, BIFF3 and
BIFF4 as plain record files. Excel 5.0 (1993) and Excel 95 wrote BIFF5 inside a compound
file, and Excel 97 to 2003 wrote BIFF8, which added Unicode text and a shared string
table. Nearly all .xls files met today are BIFF8.
Variations
| Format | Variation | About | Open |
|---|---|---|---|
.XLS | Excel 5.0 and 95 workbook (BIFF5) | Excel 5.0 and 95 workbooks: BIFF records in a compound file’s Book stream. | Open |
.XLS | Excel 97–2003 workbook (BIFF8) | Excel 97–2003 workbooks: BIFF records and a shared string table in a compound file. | Open |
Excel 5.0 and 95 (BIFF5)
The first BIFF stored in a compound file, which let a workbook hold several sheets. Text is stored in single-byte characters of a code page, inside the cell records.
The compound file holds a stream named Book. Its first record is a BOF
record (type 0x0809) whose version field is 0x0500.
Excel 97 to 2003 (BIFF8)
The last and most common BIFF. Text can be Unicode, and the text of cells is kept once in a shared string table that the cells refer to by number.
The compound file holds a stream named Workbook. Its first record is a
BOF record (type 0x0809) whose version field is 0x0600.
Not described
Each variant lists its own gaps: see BIFF8 and BIFF5.
Known, not yet covered
- Reference: BIFF2, BIFF3 and BIFF4 (the older, workbook-less
.xlsfiles of Excel 2 to 4), documented in the OpenOffice.org Excel file format description; there is no page for them. - Viewer: the explorer opens no
.xlsfile of any version yet.
Links
Software
- Microsoft Excel – Microsoft’s spreadsheet, which opens and saves .xls (Windows, macOS, web, mobile)
- LibreOffice Calc – free office suite’s spreadsheet, which opens and saves .xls (Windows, macOS, Linux)
- Google Sheets – online spreadsheet that imports and exports .xls (web browsers)
- Apple Numbers – Apple’s spreadsheet, which imports .xls (macOS, iOS)
Developers
- xlrd – library that reads
.xlsfiles (Python) - Apache POI – library for Office files, reading and writing
.xlsthrough its HSSF classes (Java) - SheetJS – library that reads and writes spreadsheets (JavaScript)
Reference
- [MS-XLS]: Excel Binary File Format (.xls) Structure – Microsoft’s full specification of BIFF8
- [MS-CFB]: Compound File Binary File Format – Microsoft’s specification of the compound file container