Parsing Excel Spreadsheets with Swift's Codable Protocols
First off: awesome work!<p>Correctly reading the data from XLSX is a lot more complex than described or implemented here, mostly because Excel is so robust in reading files and there are many sloppy writers.  If you&#x27;re interested, there&#x27;s a many-thousand page ECMA-376 specification: <a href="https:&#x2F;&#x2F;www.ecma-international.org&#x2F;publications&#x2F;standards&#x2F;Ecma-376.htm" rel="nofollow">https:&#x2F;&#x2F;www.ecma-international.org&#x2F;publications&#x2F;standards&#x2F;Ec...</a><p>- to correctly get the first worksheet, you actually need to parse the workbook.xml file and look into the sheets array to find the corresponding relationship IDs.  This is explained in section 18.2.20 (page 1579 in the part 1 PDF). iOS Numbers used to write worksheets in the opposite order, which messes up the naive attempt to read the relationships file in order.<p>- the attribute &quot;s&quot; in a cell is an index into the styles table, while the cell type &quot;s&quot; corresponds to the shared string table.  If you&#x27;re curious, its in section 18.1.3.4 (page 1604 in the part 1 PDF)<p>PS: We build and maintain parsers and writers for spreadsheets in JavaScript (<a href="https:&#x2F;&#x2F;github.com&#x2F;SheetJS&#x2F;js-xlsx&#x2F;" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;SheetJS&#x2F;js-xlsx&#x2F;</a> is our most popular project), including a CLI script to convert files to CSV. Some of our users use JSC in the context of Swift applications, ingesting data in JS and returning a CSV for further processing in Swift.