Introduction
XLSX is the default format of
Microsoft Excel since Excel
2007, replacing the older binary .xls.
Like DOCX it belongs to Office Open XML
(ECMA-376 and ISO/IEC 29500): a ZIP archive of XML files holding the workbook, one part
per worksheet, the text shared between cells, the styles, and any charts, pictures and
pivot tables.
.xlsm is the same layout with macros, and .xltx a
template.
Structure
xl/workbook.xml lists the sheets, and each sheet lives in its own part
such as xl/worksheets/sheet1.xml. A sheet holds rows of cells
(c), each with its reference, like A1, a value
(v) and optionally a formula (f). Text is usually not stored
in the cell: the cell holds a number that indexes xl/sharedStrings.xml,
so repeated text is stored once. Number formats, fonts and fills live in
xl/styles.xml. The parts are described on
Package and parts, and cells,
formulas, strings and styles on
Cells, strings and styles.
zip[Content_Types].xml, _rels/.relsXMLzipxl/workbook.xml the sheets and defined namesXMLzipxl/worksheets/sheet1.xml … one part per sheetXMLzipxl/sharedStrings.xml the text used in cellsXMLzipxl/styles.xml number formats, fonts, fills, bordersXMLzipdocProps/ title, author and datesXML
Key programs and divergence from the standard
These pages describe the standard (ECMA-376 5th edition, ISO/IEC 29500) and what four widely used programs actually do, read from Microsoft’s own implementation notes and from the programs’ source files:
- Microsoft Excel, through [MS-OI29500] v20260818 (section 2.1, the notes on Part 1 chapter 18);
- LibreOffice Calc,
sc/source/filter/oox/sheetdatacontext.cxxandworksheetfragment.cxx(master branch); - Apache POI,
XSSFCell,XSSFDataValidationandDateUtil(trunk); - openpyxl 3.1,
worksheet/_reader.pyandutils/datetime.py.
Divergence from spec
| Where | The standard says | Programs do |
|---|---|---|
Cell type d (cells) | Part 1 18.18.11 lists d, “a date in the ISO 8601 format”, and the Strict schema has it; the Transitional ST_CellType in Part 4 does not | Excel supports only a limited set of the ISO 8601 forms ([MS-OI29500] 18.3.1.96). LibreOffice reads it (setDateCell). openpyxl parses dates, times, date-times and also PT… durations. POI’s XSSFCell.getBaseCellType has no branch for d, so its default branch throws “Illegal cell type” |
| Boolean value | [MS-OI29500]: 1 or 0 | LibreOffice also accepts true in a b cell (its source comment: “some generators may write true or false”); openpyxl does bool(int(value)), which fails on true. The explorer accepts both |
Cell without r | the prose does not explain the default; [MS-OI29500] 18.3.1.4: the column after the previous cell, or the first column | LibreOffice and openpyxl both count up from the previous cell’s column |
| 29 February 1900 | the 1900 date system counts a day 60 (see cells) | openpyxl from_excel refuses 60 up to (but excluding) 61 with a ValueError and adds a day to values below 60; POI DateUtil maps day 60 to 1 March 1900 (“Excel thinks 2/29/1900 is a valid date”); the explorer shows 29 February 1900. Excel ignores dateCompatibility and uses the compatibility base unless conformance is strict ([MS-OI29500] 18.2.28 j) |
dataValidation showDropDown | 1 means show the drop-down | see Sheet features: LibreOffice reads it as “suppress”, POI as the standard says; Excel is not documented in the sources read. The explorer shows the raw value with both readings |
| Built-in number format ids 14, 22, 37 to 40, 47 and ko-KR 55 | the codes of 18.8.30 (mm-dd-yy, m/d/yy h:mm, #,##0 ;(#,##0) …) | Excel uses m/d/yyyy, m/d/yyyy h:mm, #,##0_);(#,##0), mm:ss.0 and yyyy/mm/dd ([MS-OI29500] 2.1.712 a); the explorer shows Excel’s codes with the standard’s text beside them (cells) |
Theme colour index (theme on a colour) | “an item of the clrScheme collection”, whose own order is dk1, lt1, dk2, lt2, accent1 … | LibreOffice maps index 0 to lt1, 1 to dk1, 2 to lt2, 3 to dk2, then accent1 to accent6, hlink, folHlink (XlsColor::setTheme); the explorer does the same. [MS-OI29500] 2.1.694: when several colour attributes are present Office keeps the highest of auto, indexed, rgb, theme |
| Colour of a differential format fill | solid fills use fgColor, patterns bgColor (18.8.32) | LibreOffice (Fill::finalizeImport, dxf case) takes the colour of a solid or unpatterned differential fill from bgColor; the explorer does too |
| General alignment of a Boolean | Boolean and error values are centred (18.8.30, “General”) | The explorer centres them. LibreOffice’s HTML export right-aligns a Boolean like a number |
| Number formats in LibreOffice’s CSV export | — | For the format dd\-mmm\-yyyy\ hh:mm:ss.000 LibreOffice’s CSV export writes its default date and time, its HTML export the formatted text; the explorer’s text equals the HTML (45 cells of DateFormatTests.xlsx) |
External sheet data sheetId, connection type, externalLink, XML map booleans (data) | 18.14.13: sheetId is 1-based; 18.13.3: type 3 is a file-based connection; 18.14.8: extLst excludes the three link kinds; 18.16.2: booleans are xsd:boolean | Excel ([MS-OI29500] 2.1.846, 829, 842, 857): sheetId 0 to 65533; Office does not use type 3; an extLst may follow a link; Map booleans must be written true or false, not 1 or 0. Behaviour of LibreOffice, POI and openpyxl for these parts was not read |
cfRule, filters, table, definedName and others | optional or unrestricted attributes and elements | [MS-OI29500] lists many requirements and limits for Excel; they are given at the place each element is described, on Sheet features and the other pages |
Where each program claim above was read (copies of the files are kept in the
project’s research/xlsx/programs/): LibreOffice sheetdatacontext.cxx line
213 (the true or false comment) and lines 232 to 233 (XML_d calls
setDateCell), lines 303 and 362 (mnCol reset to -1 and incremented for a cell
without r); worksheetfragment.cxx lines 110 to 113 (showDropDown read
into mbNoDropDown); stylesbuffer.cxx line 263 (XlsColor::setTheme)
and lines 1986 to 1993 (the differential fill case of Fill::finalizeImport). Apache POI
XSSFCell.java lines 715 to 732 (getBaseCellType, default branch “Illegal cell
type”); DateUtil.java lines 430 to 437 and 459 to 466 (the 29 February 1900 comments);
XSSFDataValidation.java lines 224 to 225 (getSuppressDropDownArrow returns the
negation of showDropDown). openpyxl worksheet/_reader.py lines 205 to 209 (the column
counter) and 232 to 236 (bool(int(value)), from_ISO8601);
utils/datetime.py lines 24 (the PT duration pattern) and 119 to 122 (days below 60
and 60 up to 61). The two rows about LibreOffice’s HTML and CSV export are results of running
soffice --headless --convert-to on the named workbooks, not source reading. ClosedXML and EPPlus
were not read, so the pages make no claim about them.
Not described
The standard (ECMA-376 and ISO/IEC 29500) documents all of SpreadsheetML. The pages cover the package, cells, styles, sheet features, settings, formulas, pivots, charts, drawings, Excel extensions and data, links and revisions (metadata, shared workbook revisions, query tables, connections, external links, volatile dependencies and XML maps). These parts are not yet on the pages.
Known, not yet covered
- Reference: smart tags, web publish items, cell watches and function groups are
described on settings; the VML shape behind a comment
(
x:ClientData, ECMA-376 Part 4 19.4, checked on a real file) is on drawings, and the form controls (VMLObjectTypevalues, thecontrolselement and the control properties part, checked against LibreOffice, not against Excel) are on drawings; the style properties ofv:shapebeyond position and size are not described; the [MS-OI29500] notes for sheet protection, protected ranges, page margins, page setup and the header and footer elements are on settings. - Reference: the per-function definitions of 18.17.7 are written for the math (62, the whole category table), logical (7), text (34), date and time (23) and lookup and reference (18) and information (17) and engineering (39) and database (12) and cube (7) functions and all 83 statistical functions, AVEDEV to GAMMALN (32) and GEOMEAN to NORMSINV (22) and PEARSON to ZTEST (29) (Part 1 has no web functions; the cube page says so); the 53 financial functions, ACCRINT to FVSCHEDULE (21) and INTRATE to YIELDMAT (32), are written, so every function of the category table of 18.17.7 has a row. The [MS-OI29500] restrictions on structure, conditional formatting, data validation, name, pivot, chart, R1C1, external name and OLE link formulas are on Formulas.
- Reference: the OLAP details of 18.10 and the programs’ divergence (LibreOffice, POI, ClosedXML) for revisions, query tables, connections, external links, volatile dependencies and XML maps (see data); the Power Query part (DataMashup, [MS-QDEFF]) is on extensions.
- Reference: password-protected packages are on the Encryption page (data spaces, Standard, Agile and extensible encryption); the binary-format encryption of [MS-OFFCRYPTO] 2.3.5 to 2.3.7, write protection, signatures and sensitivity labels are not described there.
- Viewer: the explorer opens
.xlsx,.xlsm,.xltx,.xltmand.xlam(Transitional and Strict) and shows every worksheet as a table of stored rows (200 a page) with each cell's number format applied, then the workbook, its formulas (read into a tree and written back, never evaluated unless the cell stores no value: then the result is calculated for the sheet table with the functions listed below and the formula list marks it), merged cells, hyperlinks, conditional formatting, data validation, filters, tables, comments (and threaded comments), drawings, charts (drawn from their cached values: every chart kind of 21.2: bars, columns, lines, areas, pies, doughnuts, scatter, bubble, radar, stock, pie-of-pie and bar-of-pie and surface charts, and the extended kinds of [MS-ODRAWXML] 2.24 except the region map), pivot tables and caches, external links, connections, the calculation chain, custom XML, the VBA project (modules listed with their source, never run) and the styles. A password-protected workbook is decrypted when the password is typed (Agile and Standard encryption, AES). - Viewer: the sheet table paints each cell’s fill (solid, line patterns as stripes, the grey patterns as a mix of the
two colours, linear gradients), font (bold, italic, underline, strike, colour, size, name),
alignment (horizontal, vertical, wrap, indent) and borders, resolves theme, indexed and RGB colours
with their tints, and applies conditional formats (cell value, formula, top and bottom N, above and
below average, duplicates and uniques, text rules, blanks, errors, time periods, colour scales,
data bars and icon sets as glyphs) from the cached cell values; the paint and the conditional
formats of 389 cells agree with LibreOffice’s own HTML export of
ConditionalFormattingSamples.xlsx. Number formats: the language-dependent ids (27 to 36, 50 to 58, 71 to 81) for zh-TW, zh-CN, ja-JP, ko-KR and th-TH when the file’s own formats name the language, the Japanese and Republic of China eras, Buddhist and Thai year letters, and fractions with text between the digit groups (Apache POI’s Excel-authored table: 2 of its 445 rows still differ). - Viewer: column widths (the stored
widthtimes 7 pixels, [ECMA-376-1] 18.3.1.13, hidden columns not drawn), row heights (htin points converted to pixels) and merged ranges (a colspan on the top-left cell, a rowspan when every covered row is stored and on the same page of 200 rows) are drawn; the 73 merged colspans ofTables.xlsxequal LibreOffice’s HTML export, which writes each column 4 to 5 pixels wider than width times 7. - Viewer: diagonal borders, text rotation (0 to 180, 255), shrink to fit and
line pattern fills are drawn (Styles;
the stripe widths have no oracle, since LibreOffice paints a flat colour).
The Excel 2010 conditional formats (x14) are applied: a rule with its own priority is evaluated like a plain one,
and the data bar extension is found through the
x14:idGUID of the plain rule ([MS-XLSX] 2.6.27, 2.6.30), giving the lengths, the negative colour, the axis (automatic, middle, none), the direction and the gradient. Icon sets are drawn as pictures (arrows, flags, circles, signs, symbols, signal bars, quarters, stars, triangles, boxes: the 20 sets of [MS-XLSX] 2.7.10 with the shapes and colours of its figure, the first icon for the lowest values per [ECMA-376-1] 18.3.1.49), and a custom set takes its icons fromcfIcon. The bar geometry (axis automatic, middle and none, the lengths, the colours, the direction) and the icon chosen for each value were compared with LibreOffice’s PDF of a generated workbook (samples/xlsx/oracle/cfx14): the axis and lengths agree within a few percent, and the icons chosen agree for 5Boxes and 3Stars; LibreOffice does not mirrordirection="rightToLeft"and measures the lengths with no axis as about 10% to 94% where the file says 0 to 100, which the viewer follows the standard on (the viewer mirrors; the shortest bar is minLength); the icon artwork is the viewer’s own outline, not Microsoft’s, and nothing was compared with Excel itself; the data bar border (one pixel lines round the bar) is drawn andshowValue="0"hides the value; autoMin and autoMax are read as the lowest value or zero. Not done: rules whose formula uses a function outside the list the viewer calculates (see the “Applied to the cells” column of the Conditional formatting table); a formula cell that stores a value shows that value and is never recalculated, and one that stores none is calculated with the math, text, logical, date and time, lookup, statistical (distributions, regression, rank and percentile included), engineering (BESSEL* and CONVERT included), information (CELL with every category except filename, INFO numfile and recalc), database and financial functions (time value, depreciation, bonds, coupons, yields, T-bills, VDB, XIRR, XNPV, ODDFPRICE, ODDFYIELD), SUBTOTAL and AGGREGATE, array and dynamic-array formulas, other sheets, defined names with relative or absolute references, INDIRECT in A1 style, OFFSET and the volatile functions (the oraclessamples/xlsx/oracle/calctocalc10equal LibreOffice, except 290 documented divergences that each test lists with-v, among them COUNT of a logical, where LibreOffice differs from 18.17.7.52, and EFFECT with a rate of 0, where it differs from 18.17.7.106); not calculated, so the cell shows its stored value or stays blank: the cube functions (they need an OLAP data connection), LAMBDA, MAP, REDUCE, SCAN, BYROW, BYCOL, MAKEARRAY, INDIRECT in R1C1 style, CELL("filename"), the INFO categories that describe the running application, and R1C1 notation; number formats not done: the calendar types and number systems of the language info (their byte values are undefined in ECMA-376-1 and MS-XLSX and there is no oracle; the Hijri calendar itself,b2or[~hijri], is done and equals LibreOffice over 1,985 dates),[$-F800]and[$-F400](they follow the system locale),[DBNum1]to[DBNum3], and month and day names in any language but English; the POI fraction rows now run and equal Excel; charts: radar charts are drawn as polygons, bubble charts as sized circles, stock charts with hi-low lines and up/down bars, pie-of-pie and bar-of-pie charts with a second pie or column, surface charts flat or 3-D, and waterfall, histogram, Pareto, box and whisker, funnel, treemap and sunburst charts (the viewer’s own geometry, tested on byte-built parts only); the region map is listed, not drawn, since the part has no map; the slicer cache, slicer, timeline cache, timeline, query table and rich data parts are shown as every element with its attributes (Features). Real workbooks were found for the slicer cache and slicer (EPPlusControl.xlsm), the query table (Open XML SDKQueryTable.xlsx) and rich data (EPPlusRichData.xlsxand a web-image workbook): in each, every element of the part’s own XML is listed with its attributes (19 checks intest-xlsx-built.mjs). No workbook with a timeline or timeline cache part was found in the test files of Open XML SDK, EPPlus, ClosedXML or LibreOffice, so those two rest on the schemas of [MS-XLSX] only; the Power Query part is read (customXmlDataMashup, two Excel-written workbooks of ewc3labs, 18 checks); the data model (xl/model/item.data, a container of [MS-XLDM]: a 4096-byte header with the byte order markFF FEand the signatureSTREAM_STORAGE_SIGNATURE_)!@#$%^&*(, Xpress-compressed files each ended by a CRC marker, a backup log and a virtual directory; one real workbook with this part exists (ClosedXMLCubeFromRange-Input.xlsx): its container is read, the files are decompressed, the CRC markers checked and the tables and columns listed; the column files (.idf, dictionaries) are not decoded), metadata, web extension, ActiveX and control parts and VML drawing shapes are listed as parts but their contents are not decoded; a sheet part over 64 MB is not read. RC4 and extensible encryption are not decryptable by definition: [MS-OFFCRYPTO] 2.3.4.7 says the key of an ECMA-376 package uses an ECB-mode block cipher (RC4 is the cipher of the binary Office formats only), and extensible encryption names a third-party module by GUID; the explorer shows the header of both. - Reference: sources read for the viewer (saved under research/xlsx and research/xlsb in the project): the ISO/IEC 29500-1 text of 18.8.30 as quoted by Microsoft Learn (number format ids and the General rule), [MS-OFFCRYPTO] (block keys, key derivation and verifier checks, tested against msoffcrypto-tool's decrypted output byte for byte) and [MS-OVBA] v20260519 (the compression and the dir stream record ids); ECMA-376 5th edition Part 1 (text), the Transitional and Strict schemas and [MS-OI29500] v20260818 are saved under research/ooxml and were read for the Sheet features page.
Links
Software
- Microsoft Excel – Microsoft’s spreadsheet, which uses XLSX by default (Windows, macOS, web, mobile)
- LibreOffice Calc – free office suite’s spreadsheet, which opens and saves XLSX (Windows, macOS, Linux)
- Google Sheets – online spreadsheet that imports and exports XLSX (web browsers)
- Apple Numbers – Apple’s spreadsheet, which imports and exports XLSX (macOS, iOS)
- ONLYOFFICE – office suite built around the Office Open XML formats (Windows, macOS, Linux, web)
Developers
- openpyxl – library that reads and writes XLSX (Python)
- XlsxWriter – library that writes XLSX (Python)
- Apache POI – library for Office files, XLSX through its XSSF classes (Java)
- SheetJS – library that reads and writes spreadsheets (JavaScript)
- Open XML SDK – Microsoft’s library for Office Open XML packages (.NET)
Reference
- ECMA-376 Office Open XML File Formats – Ecma International’s standard for DOCX, XLSX and PPTX