Import CSV to class structure as the user defines

Posted by Assimilater on Stack Overflow See other posts from Stack Overflow or by Assimilater
Published on 2010-05-28T21:47:03Z Indexed on 2010/05/28 21:52 UTC
Read the original article Hit count: 223

Filed under:
|
|

I have a contact manager program and I would like to offer the feature to import csv files. The problem is that different data sources order the fields in different ways. I thought of programming an interface for the user to tell it the field order and how to handle exceptions.

Here is an example line in one of many possible field orders: "ID#","Name","Rank","Address1","Address2","City","State","Country","Zip","Phone#","Email","Join Date","Sponsor ID","Sponsor Name" "Z1234","Call, Anson","STU","1234 E. 6578 S.","","Somecity","TX","United States","012345","000-000-0000","[email protected]","5/24/2010","z12343","Quantum Independence"

Notice that in one data field "Name" there is a comma to separate last name and first name and in another there is not.

My plan is to have a line for each field (ie ID, Name, City etc.) and a statement "import to" and list box with options like: Don't Import, Business>Join Date, First Name, Zip and the program recognizes those as properties of an object...

I'd also like the user to be able to record preset field orders so they can re-use them for csv files from the same download source.

Then I also need it to check if a record all ready exists (is there a record for Anson Call all ready?) and allow the user to tell it what to do if there is a record (ie mailing address may have changes, so if that field is filled overwrite it, or this mailing address is invalid, leave the current data untouched for this person, overwrite the rest).

While I'm capable of coding this...i'm not very excited about it and I'm wondering if there's a tool or set of tools out there to all ready perform most of this functionality...

I hope this makes sense...

© Stack Overflow or respective owner

Related posts about database

Related posts about vb.net