Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What do excel xml cell attribute values mean?

Tags:

xml

excel

cell

Looking at the xml of an excel spreadsheet, I see these cells under sheetData/row:

<c r="T1" s="23" t="s"><v>17</v></c>
<c r="AP1" s="98"><v>28</v></c>

By looking at the spreadsheet, I can see that the first cell is a string (which I can look up in the sharedStrings file), and I know that the second one is the value "28", from which I hypothesise that if a cell has the attribute t="s", it is a string, otherwise it is a value. Is this correct?

I am guessing that the r, s, and t stand for 'row', 'style', and 'type', but can someone clarify for me what they mean and what the possible values for them are? E.g, I see some cells with the attribute t="str", is that the same as "s" or does it mean something special?

I couldn't find any documentation or specification for the excel xml files, so if such a thing exists it would be helpful to be pointed in it's direction.

like image 981
Benubird Avatar asked Aug 20 '13 11:08

Benubird


People also ask

What does attributes mean in Excel?

adjacent cell: A cell that is in the same row as and adjoins the current cell in a worksheet. attribute: A characteristic of some object or entity, typically encoded as a name/value pair.

What is XML data in Excel?

An XML table is an Excel table that has been mapped to one or more XML repeating elements. Each column in the XML table represents an XML element. An XML table is created when you: Use the Import command (in the XML group on the Developer tab) to import an XML data file.


1 Answers

  • r = Reference
  • s = Style Index
  • t = Cell Data Type

The documentation for the Cell class is here

The possible cell data types are:

  • b - boolean
  • d - date in ISO8601 format
  • e - error
  • inlineStr - string that doesn't use the shared string table
  • n - number
  • s - shared string
  • str - formula string

These values are in section 18.18.11 of the ECMA-376 standard which can be found here (specifically they are on pages 2442-2443 of the PDF file in the ECMA-376 4th edition part 1 download)

Looking at the XML schema later in that PDF file (page 3912, line 2301), the use of the t attribute is optional and the default value is n - i.e. a number


Part 1 of the 5th edition of the ECMA-476 spec was released in 2016. The equivalent page references for the 5th edition are: page 2451 for the documentation of ST_CellType and page 3928, line 2301 for the ST_CellType entry in the XML schema

like image 114
barrowc Avatar answered Oct 22 '22 19:10

barrowc