ODS is the spreadsheet type of the OpenDocument Format (ODF), an OASIS standard also published as ISO/IEC 26300. This page follows ODF 1.3: Part 2 defines the package and Part 3 the XML schema; section numbers refer to Part 3.
The package
An ODS file is a ZIP package laid out as for every OpenDocument type (see the
ODT package page for the
details): a first, uncompressed entry mimetype containing
application/vnd.oasis.opendocument.spreadsheet (or
…spreadsheet-template for .ots),
META-INF/manifest.xml listing every file and any encryption,
content.xml with the sheets, styles.xml,
meta.xml (title, author, dates, statistics) and
settings.xml (view settings such as the active sheet and zoom), and
often a Thumbnails/thumbnail.png. A spreadsheet may also be a single
XML file, Flat ODS (.fods), with all of these inside one
office:document element.
office:spreadsheet
In content.xml, office:document-content holds
office:automatic-styles and office:body, whose child
office:spreadsheet (3.7) may carry table:structure-protected
and a protection key, and holds the workbook-level elements
(table:calculation-settings, table:content-validations,
table:label-ranges, variable and field declarations), one
table:table per sheet, and then table:named-expressions
(named ranges), table:database-ranges,
table:data-pilot-tables (pivot tables), table:consolidation,
table:dde-links and table:tracked-changes.
table:table (9.1.2)
Attributes: table:name (the sheet name), table:style-name
(its table style, which says among other things whether the sheet is shown),
table:protected with table:protection-key and
table:protection-key-digest-algorithm, table:print,
table:print-ranges, table:is-sub-table,
table:template-name, the six table:use-…-styles banding
flags and xml:id. Children, in order: table:title,
table:desc, table:table-source (linked data),
table:scenario, office:forms,
table:shapes (drawings anchored to the sheet), the columns, the rows,
and table:named-expressions local to the sheet.
Columns are table:table-column elements (9.1.6), optionally grouped
in table:table-column-group, table:table-header-columns
(repeated on each printed page) or table:table-columns. Rows are
table:table-row elements (9.1.3), grouped the same way with
table:table-row-group, table:table-header-rows and
table:table-rows.
Rows and columns
| Attribute | On | Meaning |
|---|---|---|
table:number-columns-repeated | column, cell | This element stands for that many identical adjacent columns or cells (default 1). |
table:number-rows-repeated | row | This row stands for that many identical adjacent rows (default 1). Spreadsheets use it to describe the empty rows down to the last row of the sheet in a single element. |
table:style-name | column, row, cell | Automatic style giving width, height and cell formatting (see styles). |
table:default-cell-style-name | column, row | Style for cells in that column or row without their own. |
table:visibility | column, row | visible (default), collapse (hidden), filter (hidden by a filter) (19.754). |
Cells (9.1.4, 9.1.5)
A row contains table:table-cell elements, and
table:covered-table-cell elements for each cell hidden under a merged
cell. Both may hold text (text:p paragraphs, which carry the displayed
text), annotations (office:annotation, comments), drawings and even
nested tables.
| Attribute | Meaning |
|---|---|
office:value-type | Type of the cell’s value (below). |
office:value, office:currency, office:date-value, office:time-value, office:boolean-value, office:string-value | The value, by type. |
table:formula | Formula, beginning with a namespace prefix and a colon, normally of:= for OpenFormula (19.646). |
table:number-columns-spanned, table:number-rows-spanned | Size of a merged cell (default 1); the cells it covers follow as covered cells. |
table:number-matrix-columns-spanned, table:number-matrix-rows-spanned | Size of the result of an array (matrix) formula. |
table:number-columns-repeated | Number of identical adjacent cells. |
table:style-name | Cell style. |
table:content-validation-name | Data validation rule (9.4.5). |
table:protect, table:protected | Cell protection. |
xhtml:about, xhtml:content, xhtml:datatype, xhtml:property, xml:id | RDFa metadata and an identifier. |
Value types (19.389)
office:value-type | Value attribute | Encoding |
|---|---|---|
float | office:value | Number, such as 12.345. |
percentage | office:value | Number, such as 0.5 for 50%. |
currency | office:value and office:currency | Number and currency code, such as 100 and USD. |
date | office:date-value | XML Schema date or dateTime, such as 2003-04-17. |
time | office:time-value | XML Schema duration, such as PT03H30M00S. |
boolean | office:boolean-value | true or false. |
string | office:string-value, or the cell’s text if absent | Text. |
void | none | No value. |
Unlike in XLSX, dates are stored as dates, not as day counts, and the displayed text is stored as well as the value.
Cell addresses (9.2.1)
A cell address is the sheet name, a full stop and the column letters and row
number: Sheet1.A1, with column A being 1 and AA 27. Ranges join two
addresses with a colon (Sheet1.A1:Sheet1.B10). In OpenFormula, a
reference is written in square brackets, such as of:=SUM([.A1:.A10]),
where a leading dot means the formula’s own sheet and $ marks absolute
parts.
Example
<table:table table:name="Sheet1" table:style-name="ta1">
<table:table-column table:style-name="co1" table:number-columns-repeated="2"/>
<table:table-row table:style-name="ro1">
<table:table-cell office:value-type="string"><text:p>Total</text:p></table:table-cell>
<table:table-cell table:formula="of:=SUM([.B2:.B9])"
office:value-type="float" office:value="42"><text:p>42</text:p></table:table-cell>
</table:table-row>
<table:table-row table:number-rows-repeated="1048575">
<table:table-cell table:number-columns-repeated="2"/>
</table:table-row>
</table:table>