Introduction
BIFF8 is the workbook format of Excel 97, 2000, 2002 and 2003, and of nearly every
.xls file in use. Excel 2007 and later still open and save it as “Excel
97–2003 Workbook”, and many programs still export to it because almost everything can
read it. Compared with BIFF5 it added
Unicode text and a shared string table.
Microsoft publishes the format in full as [MS-XLS], one of its Office open specifications.
Structure
The file is a compound file, which starts with the signature
D0 CF 11 E0 A1 B1 1A E1, holding a stream named Workbook
(streams and substreams).
The stream is a sequence of records,
each a 2-byte type, a 2-byte length and up to 8,224 bytes of data, all
little-endian; longer data carries on in CONTINUE records. Cells are described on
Cells and rows, text on
Strings and the SST and
formulas on Formulas; the
other records on workbook
settings, styles and
conditional formats and worksheet
settings, names, links and
queries, drawing objects
and comments, charts,
PivotTables with their
SXAddl extensions, and
revisions and custom views. The
workbook globals come first: a BOF record (type 0x0809, version
0x0600), fonts, number formats, cell formats, one BOUNDSHEET record per
sheet with the offset of its records, and the SST record, the shared string table.
Each sheet then follows as its own BOF to EOF block. Text cells are LABELSST records
that point into the shared string table; numbers use NUMBER or the compact RK records.
0BOF workbook globals begin, version0x0600record…FONT, FORMAT, XF fonts and cell formatsrecords…BOUNDSHEET one per sheet: name and offsetrecords…SST the shared strings, then EOFrecords…BOF … EOF one block per sheet: rows and cellsrecords
Not described
[MS-XLS] documents every part of BIFF8, so what is missing here is work not yet done.
Known, not yet covered
- Reference: the OfficeArt record tree that fills
MsoDrawingGroupandMsoDrawing([MS-ODRAW]); the drawing page gives only the structures [MS-XLS] itself defines, plusNoteRRand theObjectParsedFormulacontents. - Reference: on names, links and queries: ConnGrbitDbt, PBT, ParamQry, the sub-structures of DConn, TxtWf, RTDOper, MDir and SerAr, and the tail offsets of QsiSXTag.
- Reference: the order and nesting rules of the records (the substream ABNF of [MS-XLS] 2.1.7) are given for drawing objects only, not for charts, PivotTables (including the layout of the PivotCache stream), the revision stream or the user names stream.
- Reference: the XmlTk structures in
CrtMlFrt, FontInfo, PivotParsedFormula, SXVDEx_Opt, SXVIFlags, AutoFmt8, the bit positions of the larger SXAddl records, RRDDefNameFlags and the rgDucr and sort-key arrays of the revision records, FactoidData and DXFN12List. - Reference: the encryption schemes behind
FilePass(XOR obfuscation, RC4 and RC4 CryptoAPI, specified in [MS-OFFCRYPTO]); the streams page says only which records stay unencrypted. - Viewer: the explorer has no viewer for BIFF8 yet: a dropped
.xlsfile is not opened as a compound file or listed as records.
Variants
- Excel 5.0 and 95 workbook (BIFF5) – BIFF records in a compound file’s Book stream, single-byte text
- Excel 97–2003 workbook (BIFF8) – BIFF records in a Workbook stream, with Unicode text and a shared string table
Links
Software
- Microsoft Excel – Microsoft’s spreadsheet, which opens and saves “Excel 97–2003 Workbook” (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