PDA

View Full Version : .plist from excel spreadsheet?




primedime
Apr 16, 2011, 03:30 PM
Is there a way to get data from an excel worksheet to a .plist file without having to copy and paste everything manually? If there are several ways, which is the best? Also, is there a better/easier way to implement info from an excel spreadsheet data in to the iPhone besides trying to create a .plist? Thanks!



chown33
Apr 17, 2011, 01:32 AM
Maybe write a program to do it. Or maybe not, unless you expect to be repeating this task many times.

The "best" way would be one that you can actually do. If you don't know how to write a program or script that runs on the Mac and tells Excel to export CSV then parses the CSV into plist form, then that's not really an option. So you should describe what you can do, and post that.

We have no idea what your experience is, what your other skills might be, or how many times you have to perform this conversion to plist. You could start by explaining what the data is, how it got into an Excel worksheet, and why you have to extract it from Excel. If the data originates somewhere else, you might be better off going to the original source, rather than trying to suck it all through the Excel sodastraw.

dantastic
Apr 17, 2011, 08:13 AM
What you want to do is save the spreadsheet as csv and then use sed to convert to plist

chown33
Apr 17, 2011, 10:48 AM
What you want to do is save the spreadsheet as csv and then use sed to convert to plist

awk might be a better choice than sed. It's more oriented towards lines with delimited fields.

In any case, the OP would have to learn the new language and write a conversion program using it. Presumably, if he already knew a suitable language (sed or awk or perl or whatever) he wouldn't have needed to ask the question.

dantastic
Apr 17, 2011, 11:00 AM
Chown, that may be correct very much depending on what the data looks like. Op should provide a few unaltered rows.

I'm suggesting sed because I'm familiar and comfortable with sed, I know awk is very powerful but I've had limited exposure to it. Many tools can do this job.

Either way, sending a kid on a wild goose chase isn't cool. These tools are difficult enough as it is without prior exposure. My suggestion was to use sed (and a few pipes) - which will likely do the job.

So op, without having to post your cv, I recon sed is what you're after. Give that an ol google. If that doesn't do the trick show us your data.

primedime
Apr 17, 2011, 01:13 PM
Thanks for the great responses... Let me tell you a bit about this data I want to use in my app...

I have an excel spreadsheet of all the all the college football coaches in the country. I have them broken up by Division (D1, D2, D3), then by University and within that there are the names, phone numbers and email addresses for all coaches at the particular program.... I want to make a simple application that just organizes this info and makes it available through a search bar and tableview.... I did an example app a few days ago with a names list of over 2000 names... It was in a .plist and I figure that might be the best way to get my database in a tableview... but could there be an option of creating an xml file for grabbing off a server or is keeping the info internal on a .plist the best way? I have this info on excel and would be willing to just copy and paste everything in to a .plist but want to see if there are more efficient options out there... thanks!

dejo
Apr 17, 2011, 01:16 PM
Why not export your Excel spreadsheet into XML?

primedime
Apr 17, 2011, 01:27 PM
I was thinking that would be an option. Let me ask you, if I convert it to XML should I be storing it on my hosting space or can I import that XML file directly in to the resources folder? I basically have the app built already, it just is lacking this data right now....

dejo
Apr 17, 2011, 01:40 PM
Let me ask you, if I convert it to XML should I be storing it on my hosting space or can I import that XML file directly in to the resources folder?

Depends on the needs on your app. If it's fairly static, you can store in within your app's Resources (but realize that changes to the data would require updates to the app, i.e. new versions). Storing on your hosting space would allow you to update the data without having to update the app but then you require internet access for your app, i.e. it's not stand-alone. Another approach would be to have your app download the data from your host and store it within your app's Documents folder and then only update it from the server on an as-needed basis.

primedime
Apr 17, 2011, 01:52 PM
Another approach would be to have your app download the data from your host and store it within your app's Documents folder and then only update it from the server on an as-needed basis

This sounds wonderful, but I am sure this is the hardest of the three to implement... Can you point me in the right direction as far as documentation goes so I can start reading up on to actually implement this?