dibun has asked for the wisdom of the Perl Monks concerning the following question:

I saw the sample code in http://perlmonks.thepen.com/176972.html and I tired to use it, it works fine but it always inserts a blank row in mysql. Any suggestions. Arunav.

edited: Thu Dec 19 15:22:43 2002 by jeffa - linkafied the mirror - here's a local link: Convert CSV export from Outlook - MySQL

  • Comment on Convert CSV export from Outlook to MySQL

Replies are listed 'Best First'.
Re: Convert CSV export from Outlook to MySQL
by CountZero (Bishop) on Dec 19, 2002 at 19:23 UTC

    If you are using MySQL, know then that there is a native MySQL function which would do exactly what you want.

    From the MySQL documentation:

    6.4.8 LOAD DATA INFILE Syntax

    LOAD DATA [LOW_PRIORITY | CONCURRENT] [LOCAL] INFILE 'file_name.txt' [REPLACE | IGNORE] INTO TABLE tbl_name [FIELDS [TERMINATED BY '\t'] [[OPTIONALLY] ENCLOSED BY ''] [ESCAPED BY '\\' ] ] [LINES TERMINATED BY '\n'] [IGNORE number LINES] [(col_name,...)]

    The LOAD DATA INFILE statement reads rows from a text file into a table at a very high speed.
    Check the documentation of MySQL to find more about it.

    CountZero

    "If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law

Re: Convert CSV export from Outlook to MySQL
by Mr. Muskrat (Canon) on Dec 19, 2002 at 15:45 UTC
      The csv file look like this Name,E-mail Address,Home Street,Home City,Home Postal Code,Home State,Home Country/Region,Home Phone,Business Street,Business City,Business Postal Code,Business State,Business Country/Region,Business Phone,Company,Job Title my name,my_name@name.com,,,,,,,,,,,,,,

        Well there's your problem!

        The script that you are attempting to use parses an email that has been exported as a CSV file.

        You will have to modify the code (and the columns of your MySQL table) to work with exported contacts.