ExcelCSV parser & database update.

Discussion in 'Java' started by Nag, Jul 13, 2005.

  1. Nag

    Nag Guest

    I have a excel sheet in CSV format. I want to parse the cell contents
    row by row and update it to different tables with cell data.
    Consider that excel sheet has 12 columns.
    Out of 12 columns, first 3 are coulmn values are inputs for updating
    table1. and next 3 columns values are inputs for
    updating table2.............like till table4.
    What is the best way to update the database here..?
    Updating 4 tables at the end of reading first row is one way.
    Is there any better approach to minimize the database hits.

    thanks for your inputs.
     
    Nag, Jul 13, 2005
    #1
    1. Advertising

  2. Nag

    shriop Guest

    Use a csv parser and a csv writer like mine for example,
    http://www.csvreader.com . Read in the csv file row by row using the
    csv parser. Have 4 open csv writers to 4 separate files. Write the
    first 3 columns to one writer, the next 3 columns to the next writer,
    etc. When the parser is done reading in the file row by row, close it
    down and close down all 4 writers. Bulk import all 4 files into the
    database into temp loading tables, using dts for example if you're on
    sql server. Once you have all 4 tables worth of data in the database,
    run 1 bulk update for each of your temp tables joining in to whatever
    table they're updating. It sounds kind of crazy, but it's actually
    pretty straightforward once you get going, and will perform the best of
    any options even across huge amounts of data.

    Nag wrote:
    > I have a excel sheet in CSV format. I want to parse the cell contents
    > row by row and update it to different tables with cell data.
    > Consider that excel sheet has 12 columns.
    > Out of 12 columns, first 3 are coulmn values are inputs for updating
    > table1. and next 3 columns values are inputs for
    > updating table2.............like till table4.
    > What is the best way to update the database here..?
    > Updating 4 tables at the end of reading first row is one way.
    > Is there any better approach to minimize the database hits.
    >
    > thanks for your inputs.
     
    shriop, Jul 13, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. joun
    Replies:
    9
    Views:
    2,284
    W.G. Ryan eMVP
    Nov 30, 2004
  2. joun
    Replies:
    5
    Views:
    2,709
  3. Bernd Oninger
    Replies:
    0
    Views:
    794
    Bernd Oninger
    Jun 9, 2004
  4. ZOCOR

    XML Parser VS HTML Parser

    ZOCOR, Oct 3, 2004, in forum: Java
    Replies:
    11
    Views:
    849
    Paul King
    Oct 5, 2004
  5. Bernd Oninger
    Replies:
    0
    Views:
    844
    Bernd Oninger
    Jun 9, 2004
Loading...

Share This Page