Reading data from Excel document in a Swift app

13,325

Solution 1

1- Open Excel and export the file as CSV

2- Use this Link to read it as array

Solution 2

If you don't need to edit the Excel document and it's stored in the new XLSX format, there's an open-source library written in Swift that allows you to parse this file and read the cell data from it: CoreXLSX.

Share:
13,325
sinio
Author by

sinio

Updated on June 09, 2022

Comments

  • sinio
    sinio about 2 years

    I have an Excel document with some tables and a lot of data points. I'd like to read from it to populate some UICollectionView cells and other parts of my app.

    Something like:

    Country | Temperature | Cost
    -----------------------------
    Spain   | 23          | 80
    France  | 26          | 60
    Italy   | 31          | 120
    

    I'd like an external database so I can change the info without having to update the app. I use Firebase in my other apps but I don't want to rely on something I might have to pay for in the future.

    So I was thinking of turning the Excel doc into a Google Sheet and reading from that using the API. But am I just making my life more difficult? It seems like a clunky solution.