Swift Convert a .numbers file or a xlsx to a csv file programmatically - swift

For a project I'm working on I have a CSV reader to read user input. But that's quite an annoying UX, cause the user has the data in a google sheet/ execl (xlsx) format or numbers format. So if the user did not convert the file to CSV before uploading, they need to navigate to the Numbers app and export the file to file to CSV there.
So I was thinking how can I make this better, first thought, yeah just read the xlsx or numbers file ..... One day googling and trying some stuff, I still didn't find a good approach.
I would love to hear your input, I'm sure somebody out there has experience with this.
I'm thinking about creating an API for it. But I prefer to handle it natively in swift.
Thanks!

Related

iOS easy way to convert and store large table

I have Excel file with table ~100x100 and need to get access to this values from iOS app.
At first, I've try to make json in Mr.DataConverter and then it's not a problem to read to array. But! Some float values didn't recognized properly, and I'd got numbers without quotes:
At the time other parsed correctly!
So, from this moment I can't parse my Json string to NSArray.
The question is:
How to convert xls to json, OR How to put and retrieve the values in iOS device?
Thanks.
You can use the DHlibxls iOS Framework and simply pull the .xls file into your app, then read and process with that framework. The framework is based on the open source libxls library on SourceForge, and has a non-attributed BSD license.
I recommend exporting the Excel spreadsheet to CSV and then using a proper CSV parser to parse the data. If you run into any issues then there is likely an issue in the spreadsheet that you would need to fix.
Alternative: If possible use excel file in formate: tab delimited-text-file. That solve all your problem. Easy to open text file in iOS with file manager/c++.
convert-an-excel-spreadsheet-to-a-tab-delimited-text-file

How to read excel file using xmldocument

I need to read the Excel data using Xmldocument.Plz help me
You shouldn't.
Better use Office Open XML libraries from Microsoft.
I can't give some code but, you have to extract xlsx contents with System.IO.Packaging, find the sheet you need, and then load it in XmlDocument.
But be advised that it is quite tricky and has many caveats to do so.

How to read pdf table content data?

I have a requirement to read a pdf file having tabular format data only like in excel file. I need to extract the cell value of given pdf file.
Is it be anyhow possible using itext API. If you have something to share then please share it or any other solutions?
The PDF format is just a canvas where text and graphics are placed without any structure information. As such there aren't any iText-objects in a PDF file. In each page there will probably be a number of Strings, but you can't reconstruct a phrase or a paragraph using these strings. There are probably a number of lines drawn, but you can't retrieve a Table-object based on these lines.
In short: parsing the content of a PDF-file is NOT POSSIBLE with iText.
You can try this! This lets you read PDF pages.
I recently ran into this problem. I wasn't able to make it work with itext.
An alternate solution I found was to open a PDF document in Adobe and export it to xml. At least with my PDF's it preserved the table information and then I was able to programmatically work with the XML to generate tabular files like excel etc.
The other issue I ran into was that Adobe only lets you export one file at a time and I had lots of files. Luckily Adobe also has a merge function. I ended up merging all the files together and then exporting them as one big XML file and working with that file to generate what I needed.

What is the fastest and easiest way of generating a report on iPad

I need my App to generate a report which can be emailed. It must be in some common format e.g. PDF or Excel or CVS.
It does not necessarily have to be graphical...it could just be text.
What is the easiest and fastest way of doing this, I am even willing to use an open source SDK or purchase one.
Did you search stackoverflow or the web already for people talking about doing something similar?
I did, and here's some Q+As I found about generating PDFs:
PDF generation using data
Excel:
Generate a spreadsheet file on iOS that is readable both by Excel and Numbers
CSV:
How to export data to a csv file with iPhone SDK 3.0?

Is there any way to parse Microsoft excel in iPhone?

I want to parse an excel sheet and have to display the content in table view. Suggestions please.
The easiest way is to save your excel file as a text file with tab delimiters. This way its straight forward. In case you like to do some "intelligent" parsing - you may just take a look at one of these many parser tutorials for the iPhone. I am sure, you will be able to build on these sample quite easily.