NetTalk Central

Author Topic: Import CSV file  (Read 1758 times)

olu

  • Sr. Member
  • ****
  • Posts: 351
    • View Profile
    • Email
Import CSV file
« on: October 06, 2013, 10:55:57 PM »
Please what is the best way to import a csv file and write it into my database. I have a contact list in csv format that I need to import into my application contact file (backend sql). I was going to use office inside, but only got version 2 and the server has not got office installed on it. Will office inside work without office on the server

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11193
    • View Profile
Re: Import CSV file
« Reply #1 on: October 06, 2013, 11:19:33 PM »
Hi Olu,

there are lots of ways to do this - Office Inside is one, but might be overkill for a CSV file.

a) Declare a table in your dictionary - use Basic driver, and then just loop through this table (perhaps in a process procedure) adding the records to your other table?

b) Use stringTheory =
loadFile
split on CRLF
for each line
  split again on ,  (using a second st object)
  copy fields into your record and save new record

Personally I'd use b) - especially if this was a one-time import (because then no dict structure required).

cheers
Bruce


olu

  • Sr. Member
  • ****
  • Posts: 351
    • View Profile
    • Email
Re: Import CSV file
« Reply #2 on: October 09, 2013, 12:20:44 AM »
Thanks bruce. Not only was I able to use your advice (b) to get an import to work but also was able to use the stringtheory to do export as well. Thanks.