📦.xlsx – ein ZIP voller XML
Seit Excel 2007 ist die Standarddatei ein Office-Open-XML-Paket (ECMA-376, ISO/IEC 29500): ein ZIP-Archiv (50 4B 03 04) mit XML-Teilen, die über Beziehungen verbunden sind. Benenne eine .xlsx in .zip um – und du kannst hineinsehen.
🌳Paketbaum
Zellen des Blatts „Umsatz“: <sheetData> mit <row> und <c>.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships">
<dimension ref="A1:D3"/>
<sheetData>
<row r="1">
<c r="A1" t="s"><v>0</v></c>
<c r="B1" t="s"><v>1</v></c>
<c r="C1" t="s"><v>2</v></c>
<c r="D1" t="s"><v>3</v></c>
</row>
<row r="2">
<c r="A2" t="s"><v>4</v></c>
<c r="B2"><v>4.99</v></c>
<c r="C2"><v>2</v></c>
<c r="D2"><f>B2*C2</f></c>
</row>
<row r="3">
<c r="A3" t="s"><v>5</v></c>
<c r="B3"><v>12.8</v></c>
<c r="C3"><v>0.125</v></c>
<c r="D3"><f>B3*C3</f></c>
</row>
</sheetData>
</worksheet>📚 Quelle: ECMA-376 Teil 1 §18 (SpreadsheetML), Teil 2 (Open Packaging Conventions); Dateiliste abgeglichen mit einer von LibreOffice erzeugten .xlsx.
🔗Wie ein Leser die Zellen findet
[Content_Types].xml ──► sagt, welcher Teil was ist (Content-Type je PartName)
_rels/.rels
└─ rId1 officeDocument ──► xl/workbook.xml
└─ <sheet name="Umsatz" sheetId="1" r:id="rId1"/>
│
xl/_rels/workbook.xml.rels ◄───────────────────────────────────────────┘
├─ rId1 worksheet ──► xl/worksheets/sheet1.xml <c r="A1" t="s"><v>0</v></c>
├─ rId2 sharedStrings ──► xl/sharedStrings.xml <si><t>Artikel</t></si> ◄─ Index 0
└─ rId3 styles ──► xl/styles.xml <cellXfs> ◄─ s="1"[Content_Types].xml und _rels/.rels haben feste Namen. „sheet1.xml“ ist Konvention – maßgeblich ist die Beziehung.<sheets> in workbook.xml, nicht der Dateiname.✍️Zellen → XML (Live-Editor)
| A | B | C | D | |
|---|---|---|---|---|
| 1 | ||||
| 2 | ||||
| 3 | ||||
| 4 | ||||
| 5 |
<c r="D2"><f>B2*C2</f></c>Die Formel steht ohne „=“ in <f>. Ein Programm, das nicht rechnet (wie dieser Editor), lässt <v> weg und setzt in workbook.xml <calcPr fullCalcOnLoad="1"/> – dann rechnet Excel beim Öffnen alles neu (so macht es auch openpyxl).
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"><dimension ref="A1:D5"/><sheetData><row r="1"><c r="A1" t="s"><v>0</v></c><c r="B1" t="s"><v>1</v></c><c r="C1" t="s"><v>2</v></c><c r="D1" t="s"><v>3</v></c></row><row r="2"><c r="A2" t="s"><v>4</v></c><c r="B2"><v>4.99</v></c><c r="C2"><v>2</v></c><c r="D2"><f>B2*C2</f></c></row><row r="3"><c r="A3" t="s"><v>5</v></c><c r="B3"><v>12.8</v></c><c r="C3"><v>0.125</v></c><c r="D3"><f>B3*C3</f></c></row><row r="4"><c r="A4" t="s"><v>4</v></c><c r="B4" t="b"><v>1</v></c><c r="C4" s="2"><v>0.15</v></c></row><row r="5"><c r="A5" t="s"><v>6</v></c><c r="B5" s="1"><v>45292</v></c></row></sheetData></worksheet>
dimension ref="A1:D5" · Shared Strings: count=8 Verwendungen, uniqueCount=7 verschiedene Texte.
📚 Quelle: ECMA-376 Teil 1 §18.3.1.4 c (Cell), §18.18.11 ST_CellType, §18.4 Shared String Table, §18.8.30 numFmt (eingebaute Formate 0–49).
🏷️Zelltypen (Attribut t)
| t= | Bedeutung | Beispiel |
|---|---|---|
| n | Zahl (Standard, darf fehlen) | <c r="B2"><v>4.99</v></c> |
| s | Shared String – <v> ist der Index | <c r="A1" t="s"><v>0</v></c> |
| inlineStr | Text direkt in der Zelle | <c r="A1" t="inlineStr"><is><t>Käse</t></is></c> |
| str | Text-Ergebnis einer Formel | <c r="E1" t="str"><f>A1&"!"</f><v>Artikel!</v></c> |
| b | Wahrheitswert 1/0 | <c r="B4" t="b"><v>1</v></c> |
| e | Fehlerwert | <c r="F1" t="e"><f>1/0</f><v>#DIV/0!</v></c> |
| d | Datum als ISO-8601-Text (selten, Excel schreibt es nicht standardmäßig) | <c r="A9" t="d"><v>2024-01-01</v></c> |
🎨Stile: vom s-Attribut zum Zahlenformat
<c r="A5" s="1"><v>45292</v></c>
│
▼ styles.xml
<cellXfs> xf[0] numFmtId="0" (Standard)
xf[1] numFmtId="14" ──► eingebautes Format 14 = kurzes Datum (gebietsschemaabhängig)
xf[2] numFmtId="9" ──► eingebautes Format 9 = "0%"
<numFmts> eigene Formate ab numFmtId 164, z. B. <numFmt numFmtId="164" formatCode="yyyy-mm-dd"/>
│
▼
Anzeige: 01.01.2024 (gespeichert bleibt die Zahl 45292)<f> steht SUM(B2,B3) mit Komma als Argumenttrenner – auch wenn die deutsche Oberfläche=SUMME(B2;B3) anzeigt. Die Übersetzung passiert nur in der Anzeige.