问题
iam Working on a application where we can import contacts from facebook,linkedin,gmail etc,.. Same like i have an excel sheet with contact numbers and email Id's ,i need to import those contact numbers and email id's from Excel sheet. I have googled it like hell,found some answers saying that,save excel sheet in CSV format and you can parse it with CSV parser. So can any1 Please tell me Which is the best way to import those Excel Sheet data into my iphone App.
Thanks in Advance.
回答1:
There is an open source C library on Source Forge called libxls that you can use to read a .xls file (the older non-XML format). In addition to that, there is a ObjectiveC framework that wraps the C library called DHlibxls. The library will let you read both string and numeric values. The library is quite mature and stable.
回答2:
Excel, like PDF and others, is a bloated format that comes in different flavors that have been added on over its lifetime which spans more then a decade. That is why people urge you to use CSV, because Excel is ridiculous and unwieldy. The documentation of the format is 250 pages long.
For XLS (2003 and before) you could consider this library (though I've never used it): http://libxls.sourceforge.net
However, in my own workflow (in which I have control over the format of data sent to me) I have the authors make TSV (tab separated value) files. You can just copy and paste your Excel cells into a text editor to make one. Then it is easy to parse, assuming none of the cells contain a tab character. You could also go the scripting route. Roo is a fine gem for Ruby that can handle several kinds of open office and microsoft formats. If you don't have this kind of control though, then you either have to write you own parser (I'd rather quit my job) or find one written in C or Objective-C.
来源:https://stackoverflow.com/questions/14152223/how-to-import-excel-sheet-data-into-my-iphone-app