Element names below are from ECMA-376 Part 1, chapter 18 (SpreadsheetML). A worksheet has up to 1,048,576 rows and 16,384 columns (A to XFD).
A worksheet part
The root worksheet holds, in order: sheetPr,
dimension (the used range, such as A1:D20),
sheetViews, sheetFormatPr (default row height and column
width), cols (col elements with min,
max, width, style, hidden,
outlineLevel), sheetData, then protection, auto-filter,
mergeCells, conditionalFormatting,
dataValidations, hyperlinks, page setup, headers and
footers, drawing, tableParts and extLst.
<sheetData>
<row r="1" spans="1:3">
<c r="A1" t="s"><v>0</v></c>
<c r="B1"><v>42.5</v></c>
<c r="C1" s="1"><f>B1*2</f><v>85</v></c>
</row>
</sheetData>
A row has r (1-based row number), and optionally
spans (a hint of the columns used), s with
customFormat (row style), ht with
customHeight (height in points), hidden,
outlineLevel, collapsed, thickTop,
thickBot and ph. Rows and cells appear in order; missing
ones are empty.
Cells
| Attribute or child | Meaning |
|---|---|
r | The cell’s A1-style reference. May be omitted, in which case the cell follows the previous one. |
s | Index into the cellXfs list; default 0. |
t | Type of the value, default n (below). |
cm, vm | Cell metadata and value metadata indexes (the metadata part). |
ph | Show phonetic guides. |
f | The formula, if any. |
v | The value (for a formula, the last calculated result). |
is | Inline rich text, for t="inlineStr". |
t | Type | The v element holds |
|---|---|---|
n | Number | A number in decimal text, such as 42.5 or 1E-3. |
s | Shared string | A 0-based index into the shared strings. |
str | Formula string | Text result of a formula. |
inlineStr | Inline string | No v: the text is in is, as in a shared string item. |
b | Boolean | 0 or 1. |
e | Error | One of #NULL!, #DIV/0!, #VALUE!, #REF!, #NAME?, #NUM!, #N/A. |
d | Date | An ISO 8601 date and time as text, such as 2012-03-01T14:30:00 (below). |
The d type is not in the first edition of ECMA-376 (its
ST_CellType has only the six types above). Microsoft’s Open XML SDK lists it as
CellValues.Date, written "d", “only available in Office
2010 and later”. It is a feature of Strict SpreadsheetML, which can store a date as
text instead of a serial number: only local dates and times from 0001-01-01 00:00 to
9999-12-31 23:59:59.999, with no time zone or UTC marker, written as
YYYY-MM-DD, hh:mm:ss or
YYYY-MM-DDThh:mm:ss (a write-up of Strict dates on Eric
White’s blog, which shows the
same date as <v>40957</v> in a transitional file and as
t="d" with <v>2012-03-01T14:30:00</v> in a
Strict one). A reader should accept both forms.
Dates and times are ordinary numbers shown with a date format: the whole part is a
day count and the fraction the time of day. In the default 1900 system day 1 is
1 January 1900, and Excel counts a non-existent 29 February 1900 (day 60) for
compatibility with Lotus 1-2-3; with date1904 set in
workbookPr, day 0 is 1 January 1904.
Formulas
The formula is stored as text without the leading =, using A1
references and English function names; functions newer than Excel 2007 carry a
prefix such as _xlfn.. Attributes of f:
| Attribute | Meaning |
|---|---|
t | normal (default), array (an array formula over ref), dataTable (a what-if data table, with dt2D, dtr, del1, del2, r1, r2), shared (a formula shared by several cells). |
ref | Range an array, data table or shared formula covers. |
si | Shared formula group index. The first cell of the group has t="shared", ref, si and the text; the other cells have only t="shared" and si, and adjust its relative references. |
ca | Calculate the cell every time (volatile). |
aca, bx | Always calculate an array formula; the formula assigns a value to a name. |
Excel: where it differs from the standard
[MS-OI29500] notes 2.1.590, 2.1.620, 2.1.630, 2.1.644, 2.1.660 and 2.1.671 to 2.1.678 (sections 18.3.1 and 18.4 of ISO/IEC 29500) say how Excel treats cells, formulas and shared strings. Each row gives the standard’s rule and then what Excel does.
| Element (section, note) | Standard says | Excel does |
|---|---|---|
c (18.3.1.4, 2.1.590) | cm and vm are zero-based indexes into an unnamed collection; s is an unsigned integer into an unnamed collection; r is optional with no stated meaning; the example shows style index 6 for a fragment that says 1. | cm and vm are one-based indexes into the cellMetadata collection of the metadata part, both below 2147483648. s is 0 to 65490 and indexes cellXfs. A cell without r is in the column after the previous cell of the row, or column A for the first. The example should read 1. |
row (18.3.1.73, 2.1.644) | Unsigned integers. | r is 1 to 1048576 and rows come in non-decreasing order; outlineLevel is 0 to 7; s is 0 to 65490. |
f (18.3.1.40, 2.1.620) | Any cell may be a data table’s input cell; bx true assigns a value to a name; del2 applies to data tables; aca marks an array formula; the top left cell is the master cell; data tables recalculate with the sheet; si is optional; no word on xml:space. | Input cells must lie outside the ref range, the master row and column (and, for two-dimensional tables, the corner cell) unless deleted through del1 or del2. bx is always false. del2 is used for two-dimensional tables only. The master cell is the one with the smallest row and column in ref; the master column is the column left of it over the same rows, the master row the row above it over the same columns, and the corner cell the one above and left of the master cell. An array formula is marked by t="array"; aca is ignored on other formulas. Data tables recalculate as calcPr’s calcMode says. si must exist when t="shared" and is ignored otherwise. xml:space keeps white space as in XML 1.0. |
v (18.3.1.96, 2.1.660) | No length limit and no content rules by t; a date is ISO 8601. | At most 32767 characters; xml:space accepted. A string cell holds a zero-based shared string index, a number the text of a double, a Boolean 1 or 0, an error one of #NULL!, #DIV/0!, #VALUE!, #REF!, #NAME?, #NUM! or #N/A, and a formula cell its last result. Only a limited set of ISO 8601 date forms is read (the note refers to a list that [MS-OI29500] does not print; the forms documented above are the ones this page knows). |
is, si (18.3.1.53, 18.4.8; 2.1.630, 2.1.675) | Unbounded r and rPh children and t text. | At most 32767 r, 32767 rPh, and 32767 characters in t. |
t (18.4.12, 2.1.678) | No length limit; no word on xml:space. | At most 32767 characters; xml:space uses XML 1.0 white space rules. |
sst (18.4.9, 2.1.676) | count and uniqueCount unbounded. | Both at most 2147483647. |
phoneticPr, rPh (18.4.3, 18.4.6; 2.1.671, 2.1.673) | Phonetic text for East Asian languages; type picks an East Asian character set. | Phonetic text is limited to Japanese, and type picks the Japanese character set. |
rPr, rFont, sz (18.4.7, 18.4.5, 18.4.11; 2.1.674, 2.1.672, 2.1.677) | Children of rPr are a choice; rFont value 0 to 31 characters; sz applies to Latin and East Asian text and has no limits. | rPr children must be in the order b, i, strike, condense, extend, outline, shadow, u, vertAlign, sz, color, rFont, family, charset, scheme. The rFont length is counted before escaping. sz applies to all text, is converted to twips (so writing back may round it) and is 1 to 409.55. |
The styles part
xl/styles.xml (styleSheet) holds, in order:
numFmts (custom number formats, each numFmtId and
formatCode, ids 164 and up), fonts, fills
(the first two are reserved: none and gray125), borders,
cellStyleXfs (formats of named styles), cellXfs (the cell
formats a cell’s s points to: numFmtId,
fontId, fillId, borderId, xfId,
apply… flags, and child alignment and
protection), cellStyles (named styles, with
builtinId), dxfs (differential formats for conditional
formatting and tables), tableStyles, colors (custom
indexed palette and recent colours) and extLst. Every element and
attribute is on the styles part
page.
Built-in number formats
Number format ids below 164 are built in and need no numFmt
element (ECMA-376 Part 1, 18.8.30; Excel’s binary formats share them):
| Id | Format | Id | Format |
|---|---|---|---|
| 0 | General | 20 | h:mm |
| 1 | 0 | 21 | h:mm:ss |
| 2 | 0.00 | 22 | m/d/yy h:mm |
| 3 | #,##0 | 37 | #,##0 ;(#,##0) |
| 4 | #,##0.00 | 38 | #,##0 ;[Red](#,##0) |
| 9 | 0% | 39 | #,##0.00;(#,##0.00) |
| 10 | 0.00% | 40 | #,##0.00;[Red](#,##0.00) |
| 11 | 0.00E+00 | 45 | mm:ss |
| 12 | # ?/? | 46 | [h]:mm:ss |
| 13 | # ??/?? | 47 | mmss.0 |
| 14 | mm-dd-yy | 48 | ##0.0E+0 |
| 15 | d-mmm-yy | 49 | @ (text) |
| 16 | d-mmm | ||
| 17 | mmm-yy | ||
| 18 | h:mm AM/PM | ||
| 19 | h:mm:ss AM/PM |
Spec says / Excel does: [MS-OI29500] 2.1.712 a says Excel defines
id 14 as m/d/yyyy (the standard: mm-dd-yy), 22 as
m/d/yyyy h:mm, 37 as #,##0_);(#,##0), 38 as
#,##0_);[Red](#,##0), 39 as #,##0.00_);(#,##0.00), 40 as
#,##0.00_);[Red](#,##0.00), 47 as mm:ss.0 (the standard:
mmss.0) and, in the Korean table below, id 55 as yyyy/mm/dd (the
standard: yyyy-mm-dd). The explorer shows Excel’s codes and the standard’s text beside
them. The ids 5 to 8, 23 to 26 and 41 to 44 have no fixed text: the file’s own
numFmt gives it.
Some ids are shown differently depending on the application’s language, and further
ids exist only for East Asian and Thai versions. The file does not name its language: the explorer
takes it from the [$-xxx] language ids in the file’s own number formats (404 zh-TW, 804
zh-CN, 411 ja-JP, 412 ko-KR, 41E th-TH) and, when none is there, shows these ids as General and lists
every language’s code in the Number formats table:
| Id | zh-TW | zh-CN | ja-JP | ko-KR |
|---|---|---|---|---|
| 27 | [$-404]e/m/d | yyyy"年"m"月" | [$-411]ge.m.d | yyyy"年" mm"月" dd"日" |
| 28 | [$-404]e"年"m"月"d"日" | m"月"d"日" | [$-411]ggge"年"m"月"d"日" | mm-dd |
| 29 | [$-404]e"年"m"月"d"日" | m"月"d"日" | [$-411]ggge"年"m"月"d"日" | mm-dd |
| 30 | m/d/yy | m-d-yy | m/d/yy | mm-dd-yy |
| 31 | yyyy"年"m"月"d"日" | yyyy"年"m"月"d"日" | yyyy"年"m"月"d"日" | yyyy"년" mm"월" dd"일" |
| 32 | hh"時"mm"分" | h"时"mm"分" | h"時"mm"分" | h"시" mm"분" |
| 33 | hh"時"mm"分"ss"秒" | h"时"mm"分"ss"秒" | h"時"mm"分"ss"秒" | h"시" mm"분" ss"초" |
| 34 | 上午/下午hh"時"mm"分" | 上午/下午h"时"mm"分" | yyyy"年"m"月" | yyyy-mm-dd |
| 35 | 上午/下午hh"時"mm"分"ss"秒" | 上午/下午h"时"mm"分"ss"秒" | m"月"d"日" | yyyy-mm-dd |
| 36 | [$-404]e/m/d | yyyy"年"m"月" | [$-411]ge.m.d | yyyy"年" mm"月" dd"日" |
| 50 | [$-404]e/m/d | yyyy"年"m"月" | [$-411]ge.m.d | yyyy"年" mm"月" dd"日" |
| 51 | [$-404]e"年"m"月"d"日" | m"月"d"日" | [$-411]ggge"年"m"月"d"日" | mm-dd |
| 52 | 上午/下午hh"時"mm"分" | yyyy"年"m"月" | yyyy"年"m"月" | yyyy-mm-dd |
| 53 | 上午/下午hh"時"mm"分"ss"秒" | m"月"d"日" | m"月"d"日" | yyyy-mm-dd |
| 54 | [$-404]e"年"m"月"d"日" | m"月"d"日" | [$-411]ggge"年"m"月"d"日" | mm-dd |
| 55 | 上午/下午hh"時"mm"分" | 上午/下午h"时"mm"分" | yyyy"年"m"月" | yyyy-mm-dd |
| 56 | 上午/下午hh"時"mm"分"ss"秒" | 上午/下午h"时"mm"分"ss"秒" | m"月"d"日" | yyyy-mm-dd |
| 57 | [$-404]e/m/d | yyyy"年"m"月" | [$-411]ge.m.d | yyyy"年" mm"月" dd"日" |
| 58 | [$-404]e"年"m"月"d"日" | m"月"d"日" | [$-411]ggge"年"m"月"d"日" | mm-dd |
Thai (th-TH): 59 t0, 60 t0.00, 61 t#,##0,
62 t#,##0.00, 67 t0%, 68 t0.00%, 69
t# ?/?, 70 t# ??/??, 71 ว/ด/ปปปป, 72
ว-ดดด-ปป, 73 ว-ดดด, 74 ดดด-ปป, 75
ช:นน, 76 ช:นน:ทท, 77 ว/ด/ปปปป ช:นน, 78
นน:ทท, 79 [ช]:นน:ทท, 80 นน:ทท.0, 81
d/m/bb. The ids 5–8, 23–26 and 41–44 have no fixed text in the standard;
Microsoft’s [MS-XLS] treats them as locale-dependent formats that a file defines with
its own format string, so a reader should take them from numFmts.
The General format
From 18.8.30. General renders the cell content as well as the application can without
user guidance. In left-to-right mode strings are left aligned, Boolean and error values centred and
numbers right aligned; a date is not formatted by General but converted automatically to a date
format. A number is shown in full up to 11 characters including the decimal separator (not counting a
minus sign; leading zeros count). If it is too large it is shown in exponential form, and if it has too
many significant digits the display is truncated, whichever fits the cell width best; if nothing fits
the cell shows # across its width. Exponential form is used when the value has at least
five digits for xE-xx, when the exponent is too big for floating point, when for a negative
exponent not even one non-zero digit fits in floating point, and, if not all significant digits fit, when
the exponent is below -3 (E-xx takes four characters, so a leading 0.000 or more
pays for it). The standard says the width rule depends on the available cell width, so a viewer with no
fixed column width has to choose one.
Format code syntax (18.8.31)
A format code has up to four sections separated by semicolons: positive numbers, negative numbers,
zero, text. With two sections the first serves positive numbers and zero and the second negative
numbers; with one it serves all numbers. To skip a section its ending semicolon is still written. A
text section is last and holds @ where the cell’s text goes (without @ the
typed text is not shown); with no text section, text is not changed by the format. In a section:
| Symbol | Meaning |
|---|---|
0 | digit placeholder, shows insignificant zeros (#.00 shows 8.9 as 8.90) |
# | digit placeholder, no extra zeros (#.## shows 8.9 as 8.9) |
? | digit placeholder that puts a space for insignificant zeros, so decimal points align; also for fractions of varying digits |
. | decimal point |
% | percentage: the number is multiplied by 100 and the symbol added |
, | thousands separator when between # or 0; after a placeholder it scales by 1000 (#.0,, shows 12,200,000 as 12.2) |
E- E+ e- e+ | scientific format: 0.00E+00 shows 12,200,000 as 1.22E+07, #0.0E+0 as 12.2E+6. The zeros or number signs after the code give the number of exponent digits; E- puts a minus on negative exponents only, E+ also a plus on positive ones |
$ - + ( ) : ! ^ & ' ~ { } < > = / and space | shown as they are, without quotes; / between number symbols (0, #, ?) is the fraction symbol, otherwise a slash |
\ | shows the next character and is not itself shown (0\! shows 3 as 3!) |
* | repeats the next character to fill the column width (0*x). At most one per section; if there are several, all but the last are ignored |
_ | skips the width of the next character (_) lines positive numbers up with negative ones in parentheses) |
"text" | shows the text. Single quotation marks must not be used for text. Characters in double quotes or after a backslash are never part of the format lexicon |
@ | text placeholder ("Bob "@" Smith" shows John as Bob John Smith) |
Digits: more digits to the right of the decimal point than placeholders are rounded; more to the left
than placeholders are all shown; if only # stands left of the point, numbers below 1 begin with the
point (0.# shows .631 as 0.6). Colours are one of [Black],
[Blue], [Cyan], [Green], [Magenta],
[Red], [White], [Yellow] and must be the first item of the section;
[Color1] to [Color56] select the legacy palette by index ([Color1] is
indexed 8, [Color2] is 9, up to [Color56] = 63; a customised palette
changes them; [Color3] is red). Conditions go in square brackets with one of
= > < >= <= <> and a
value, for example [Red][<=100];[Blue][>100]; a value that meets no condition is shown as
# across the cell. Dates and times: m 1–12,
mm 01–12, mmm Jan–Dec, mmmm January–December,
mmmmm J–D; d, dd, ddd (Sun–Sat),
dddd; yy 00–99, yyyy from the date system’s minimum to 9999;
h, hh, m, mm, s, ss;
h AM/PM, h:mm:ss A/P (12-hour clock when AM or PM appears, otherwise 24-hour);
h:mm:ss.00 fractions of a second; elapsed time [h]:mm, [mm]:ss,
[ss].00. m or mm directly after h or hh, or
directly before ss, means minutes; anywhere else it is the month. A date or time format applied
to a value that is not a legal date or time shows # across the cell width.
Language ids, eras and calendars in format codes
A code may contain [$<currency>-<language info>]: the language info is a 32-bit
hexadecimal value whose bytes 0 and 1 are the language id, byte 2 the calendar type (the high bit says input
is parsed with that calendar) and byte 3 the number system type (the same high bit rule); the special
values 0xF800 and 0xF400 mean the system long date and system time format
(18.8.30, International Considerations). The codes b1 and b2 select the
Gregorian and the Hijri calendar. The era codes work for ja-JP and zh-TW only:
| Code | ja-JP | zh-TW | Other languages |
|---|---|---|---|
g | one Roman character for the emperor’s reign | as gg | |
gg | one kanji for the reign | the short name of the last era (since 1911) | |
ggg | two kanji for the reign | the long name of the last era | |
e | the year of the era | the year since 1912 (with g, gg or ggg before it; earlier years are special, otherwise before 1912 they are Gregorian) | yyyy |
ee | the era year with a leading zero | the era year counted from 1911 | yy |
r | becomes ee | becomes e | |
rr | becomes gggee | becomes e |
The standard does not list the eras. The explorer uses LibreOffice’s: Meiji from 1868-01-01, Taisho from
1912-07-30, Showa from 1926-12-25, Heisei from 1989-01-08, Reiwa from 2019-05-01
(i18npool/source/calendar/calendar_gregorian.cxx, gengou_eraArray), with the names of
its ja_JP.xml (明治 大正 昭和 平成 令和; the Roman characters M, T, S, H, R are the initials of
the era ids), and for zh-TW the era starting 1912-01-01 named 民國 (before it 民國前). The Thai codes
(ids 71 to 80) write the letters of the date in Thai: ว day, ด month, ป year, ช hour, น minute, ท second;
the Buddhist year (b, bb) is the Gregorian year plus 543 (LibreOffice’s
buddhist_eraArray starts at year −542). Spec says / programs do: LibreOffice
applies the era and Chinese codes the same way (the explorer’s text equals LibreOffice’s HTML export in 84
cells of locale-formats.xlsx), but it prints the Thai letters, bb and the
Chinese AM/PM words (上午/下午) as plain text or as a number, so those codes have no oracle; the
explorer formats them as the table above says. The Hijri calendar (b2 at the start of a section, or
LibreOffice’s [~hijri]) is computed as LibreOffice’s
i18npool/source/calendar/calendar_hijri.cxx does (an astronomical new-moon calculation after Jean
Meeus; the names are those of the hijri calendar in ar_SA.xml) and equals LibreOffice’s output for 1,985
dates from 1900 (samples/xlsx/hijri-formats.fods, test-xlsx-hijri.mjs); neither
ECMA-376 nor [MS-XLSX] says how a Hijri date is computed, so a program with another rule can differ by a day.
LibreOffice’s own xlsx import does not read the calendar part of [$-…] (a TODO in
numberformatsbuffer.cxx). Neither ECMA-376 nor [MS-XLSX] nor [MS-OI29500] lists the numeric calendar and number system values.
LibreOffice’s number formatter does: in svl/source/numbers/zformat.cxx
(ImpObtainCalendarAndNumerals) the calendar byte, with the high bit masked off, means 0x03 Japanese
Gengou (forces ja-JP), 0x05 Korean Dangi ([~dangi]), 0x06 and 0x17 Hijri
([~hijri]), 0x07 Buddhist ([~buddhist]), 0x08 Hebrew ([~jewish]); 0x0E to
0x13 and all other values are ignored. The number system byte, high bit masked off, runs from 0x01 Western to
0x13 Mongolian (0x02 Eastern Arabic, 0x03 Perso-Arabic, 0x04 Devanagari, 0x05 to 0x0C the Bengali, Punjabi, Gujarati,
Odia, Tamil, Telugu, Kannada and Malayalam digits, 0x0D Thai, 0x0E Lao, 0x0F Tibetan, 0x10 Burmese, 0x11 Tigrigna,
0x12 Khmer) and 0x1B to 0x27 the Japanese, Simplified Chinese, Traditional Chinese and Korean numeral styles;
LibreOffice uses the number system only to pick a reference language. Divergence from spec:
[MS-XLSX] 2.2.2 (formatCode16) puts the calendar in byte 0 and the number system in byte 1 of an
optional 16-bit value after a comma, while ECMA-376 18.8.31 puts them in bytes 2 and 3 of a 32-bit value;
LibreOffice reads the ECMA layout, and so does the explorer, which does not read the formatCode16 form. The explorer applies the calendar byte: 5 (Dangi),
6 and 0x17 (Hijri), 7 (Buddhist) and 8 (Hebrew), or the LibreOffice codes [~dangi],
[~hijri], [~buddhist], [~jewish]. Spec says / programs do:
the text of the Buddhist (the Gregorian year plus 543), Hebrew (explorer/formats/xlsx/jewish.js, the
Dershowitz and Reingold algorithm of calendar_jewish.cxx, Hebrew month names from
he_IL.xml and Hebrew letter numerals as nativenumbersupplier.cxx writes them) and Dangi
calendars equals LibreOffice’s HTML export of 1,985 dates each (samples/xlsx/calendars-formats.fods,
test-xlsx-calendars.mjs). LibreOffice’s Dangi is the Gregorian date with the year counted from the
Dangun era (year plus 2333) and the month names 1 to 12, not the lunisolar Korean calendar; the explorer copies
that. The calendar byte itself has no oracle (LibreOffice’s xlsx import drops it), so that path is per the
specification and LibreOffice’s code and is checked only to give the same text as the [~…] codes.
Calendar byte 3 (Gengou) takes the Japanese eras for g, e and r whatever the
language (LibreOffice’s zformat.cxx forces Japanese for calendar 3; no oracle either).
0xF800 and 0xF400 are the system long date and system time (LibreOffice’s
lang.h names them LANGUAGE_NF_SYSTEM_DATE and LANGUAGE_NF_SYSTEM_TIME); the
system’s own pattern is not known to a viewer, so the code written after the tag is shown, as other viewers do.
Divergence from Excel (Hijri). Microsoft Excel for Mac was asked for =TEXT(serial,"B2dd/mm/yyyy")
for every 37th serial from 61 (1,889 dates, research/xlsx/excel/hijri-excel-b2.csv). LibreOffice’s rule
(the default) gives the same date for 1,254 of them. ICU’s islamic-umalqura gives 675 and the civil tabular
calendar (islamic-civil, leap years 2, 5, 7, 10, 13, 16, 18, 21, 24, 26, 29 of the 30-year cycle) one day behind
Excel gives 1,824; the 65 others all lie in year 16 of the cycle. Excel’s rule is the tabular calendar with year 15 leap in
place of 16, with 1 Muharram 1 AH on Julian day 1948439 (hijriExcelFromGregorian in hijri.js); it
equals 1,887 of the 1,889 Excel dates (test-xlsx-hijri-excel.mjs). In that bulk run Excel gave dates years off for the two
others (serials 66291 and 67993, in 2081 and 2086) and an empty text or 0 for three more serials (46718, 58484, 58521). Asked again one
serial at a time, with their neighbours (hijri-anomalies.applescript, 15 serials), Excel gave ordinary dates and the rule equals all 15, and again in round 49 for 66290 to 66292 and 67992 to 67994 (fn-r27-accrint-searchb.applescript: 23/09/1504 and 12/07/1509 for the two, neighbours on the rule), so the five
first answers were a glitch of the bulk calculation, not a different rule: the rule agrees with every Excel answer that was not a glitch. The window’s option Hijri calendar chooses between the two rules: LibreOffice (new
moon), the default, which the 1,988 LibreOffice checks confirm, and Excel (tabular).
Digit substitution. [DBNum1] to [DBNum9] and the number system byte of the
language info change the digits. For the languages Chinese (804, 404), Japanese (411) and Korean (412)
[DBNum1] writes numbers as words (一千二百三十四), [DBNum2] in the financial
forms (壹仟貳佰…) and [DBNum3] in full-width digits (Korean: with the Hangul unit words);
in a date the year is written digit by digit and the month and day as words (二〇二〇年三月十五日).
The number system byte values 2 to 0x13 (0x11 excepted: CLDR has no decimal digits for Tigrinya) pick the digits of a script (Arabic-Indic, Persian, Devanagari, Bengali, Gurmukhi,
Gujarati, Odia, Tamil, Telugu, Kannada, Malayalam, Thai, Lao, Tibetan, Myanmar, Khmer, Mongolian) and 0x1B to 0x26 the
Chinese, Japanese and Korean sets (simple, financial, full-width). Spec says / programs do: ECMA-376
18.8.31 and [MS-XLSX] name the byte but give no digit table. The explorer’s script digits are the ten digits of the
Unicode CLDR 49 numbering systems (cldr-json cldr-core 49.0.0, Unicode 16.0.0, supplemental/numberingSystems.json,
kept as research/xlsx/cldr-numberingSystems.json), and the Chinese, Japanese and Korean number words are
LibreOffice’s (nativenumbersupplier.cxx, numberchar.h, zformat.cxx,
calendar_gregorian.cxx), ported to explorer/formats/xlsx/numerals.js. LibreOffice’s HTML export of
samples/xlsx/numerals-formats.xlsx (115 codes, 18 values) is the oracle: 1,542 cells are equal
(test-xlsx-numerals.mjs). Divergence from spec: no Microsoft program is available as an
oracle, so Excel’s own digits are not known; LibreOffice leaves plain numbers alone under the byte (only
[DBNum] changes them) and so does the explorer; its byte 0x02 (Arabic) and 0x27 (Hangul) convert nothing
(the explorer follows that for 0x27 and uses CLDR’s Arabic-Indic digits for 0x02); LibreOffice’s own Odia digit table
and Tamil zero differ from CLDR’s, and CLDR is used. A [DBNum] in a language without these sets
(English) leaves the ASCII digits; the first year of a Japanese era is written 元 under
[DBNum1] and [DBNum2]. Fractions and scientific exponents are not converted.
Month and day names. A language tag such as [$-407]mmmm or [$-411]ddd
selects the language of the month and day names. The standard (18.8.30 and 18.8.31) and [MS-OI29500] do not list the
names, so the explorer’s table (explorer/formats/xlsx/localenames.js) is LibreOffice’s: long and short months
and days for German (407), French (40C), Italian (410), Spanish (C0A), Portuguese-Brazil (416), Russian (419),
Japanese (411), Chinese-PRC (804), Korean (412), Dutch (413), Polish (415), Swedish (41D), Turkish (41F) and Czech (405).
The explorer’s text equals LibreOffice’s HTML export in all 532 names of samples/xlsx/oracle/monthnames/names.xlsx
(test-xlsx-locale.mjs). Differences to know: LibreOffice does not know the tag [$-40A] (Spanish,
traditional sort) and prints English, so the table has C0A; it prints English month names for Korean (day names
are Korean); Polish and Czech short months are Roman numerals. Spec says / programs do: Excel takes
its names from the operating system’s locale data and no copy of Excel was available, so a name can be spelled
differently there (LibreOffice’s German March abbreviation is “Mär”, where Excel is commonly reported to print “Mrz”).
Any other language prints the English names.
Names for 27 more languages (CLDR). What 18.8.31 says about the tag: [$<currency>-<language info>],
where the language info is a 32-bit hexadecimal value and bytes 0 and 1 are the 16-bit language id (LID) (Part 1, 18.8.31, the
[$USD-409] row). Part 1 contains no table of language ids and names no month or day names, so for what each id
means the explorer uses Microsoft’s MS-LCID list as copied into CPython’s Lib/locale.py
(windows_locale), and for the names the Unicode CLDR data. The table now also has Spanish traditional sort (40A),
Danish (406), Finnish (40B), Norwegian Bokmål (414), Greek (408), Hungarian (40E), Romanian (418), Ukrainian (422),
Bulgarian (402), Croatian (41A), Slovak (41B), Slovenian (424), Hebrew (40D), Arabic-Saudi Arabia (401), Hindi (439), Thai (41E),
Vietnamese (42A), Indonesian (421), Malay-Malaysia (43E), Catalan (403), Lithuanian (427), Latvian (426), Estonian (425),
Icelandic (40F), Persian (429), Chinese-Taiwan (404) and Portuguese-Portugal (816). The names are CLDR’s Gregorian
“stand-alone” names (cldr-dates-full, Unicode License v3; URLs, SHA-256 and licence in
samples/README.md), printed by scripts/xlsx/cldr-localenames.mjs; the stand-alone width is the one
that equals LibreOffice for German (Jan, Feb, Mär; So, Mo), so it matches how a lone month or day name is printed.
Limit: LibreOffice cannot be the oracle for these: it ignores or does not know most of these tags. The only check is
that the served table equals the CLDR files (test-xlsx-locale.mjs, 27 of 27); no copy of Excel was available, and
Excel’s own abbreviations may differ from CLDR’s. Persian (429) and Arabic (401) may also select another calendar in Excel (the calendar byte, not read),
where the explorer prints Gregorian names. Every language id not listed (more than 100 in MS-LCID) still prints the English names.
Names for 63 more languages (CLDR, second batch). The same source and method now also cover Afrikaans (436),
Albanian (41C), Amharic (45E), Armenian (42B), Assamese (44D), Azerbaijani (42C), Bangla (445), Basque (42D), Belarusian (423),
Galician (456), Georgian (437), Gujarati (447), Kannada (44B), Kazakh (43F), Khmer (453), Konkani (457), Kyrgyz (440), Lao (454),
Macedonian (42F), Malayalam (44C), Maltese (43A), Marathi (44E), Mongolian (450), Nepali (461), Odia (448), Punjabi (446),
Sanskrit (44F), Tamil (449), Telugu (44A), Urdu (420), Uzbek (443), Welsh (452), Zulu (435), Kiswahili (441), Filipino (464),
Irish (83C), Faroese (438), Luxembourgish (46E), Serbian Cyrillic (C1A) and Latin (81A), Norwegian Nynorsk (814), Burmese (455),
Tajik (428), Turkmen (442), Pashto (463), Uyghur (480), Tatar (444), Hausa (468), Yoruba (46A), Igbo (470), Xhosa (434),
Romansh (417), Scottish Gaelic (491), Breton (47E), Frisian (462), Maori (481), Greenlandic (46F), Tigrinya (473),
Upper Sorbian (42E), Lower Sorbian (82E), Northern Sami (43B), Spanish-Mexico (80A) and French-Canada (C0C); the check is
now 90 of 90 against the CLDR files, and the language ids were checked against windows_locale.
Left out: Sinhala (45B), because its CLDR file names lunar months, not the Gregorian ones; Corsican, because
CLDR’s file could not be fetched; and every other id of MS-LCID not named here (regional variants of the languages above
and the languages CLDR does not carry) still print the English names. As before, there is no Excel oracle: these are CLDR
spellings, which Excel may not print.