sinio
sinio

Reputation: 711

Reading data from Excel document in a Swift app

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.

Upvotes: 5

Views: 19979

Answers (3)

Max Desiatov
Max Desiatov

Reputation: 5565

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.

Upvotes: 3

Ronnie Smith
Ronnie Smith

Reputation: 18575

Excel is not precisely a database or a datastore. If you want an app then build an app - that means having a datastore/database and a User Interface, UI. As for updating data points you can automate that (preferable) or you can use your UI to manually update.

Upvotes: -4

Shehata Gamal
Shehata Gamal

Reputation: 100523

1- Open Excel and export the file as CSV

2- Use this Link to read it as array

Upvotes: 6

Related Questions