Results 1 to 8 of 8
  1. #1
    Join Date
    Feb 2004
    Location
    New York
    Posts
    45

    Unanswered: xls to csv using batch file

    xls to csv using bat file
    Hello,
    I want to gather a small portion of an Excel spreadsheet and write the data to a comma delimited file for import into another program with SQLLdr + I need to delete a first row...

    So far, I have a bat. file that grab an xls file from one directory , copy that file to another as csv format..

    But I can not find a way to remove a first row in already formated file.

    I was trying to use this in my bat file but it did not worked the way I want it. /p250 /1 2-150 by
    It just opend a file for me to delete...

    Suggestions?

    Thanky you.

    A.

  2. #2
    Join Date
    Apr 2003
    Location
    Greenville, SC (USA)
    Posts
    1,155
    Instead of removing the first row, you can exclude rows in SQLLOADER ... Just exclude the first row going in ...

    HTH
    Gregg

  3. #3
    Join Date
    Feb 2004
    Location
    New York
    Posts
    45
    Originally posted by gbrabham
    Instead of removing the first row, you can exclude rows in SQLLOADER ... Just exclude the first row going in ...

    HTH
    Gregg

    Oh, I have never done the exclusion, just a basics.
    Can you help me out with this?

    load data
    infile 'D:\temp\location.csv'
    truncate
    into table location
    fields terminated by ','
    (id, locaid)



    Thank you.

    A

  4. #4
    Join Date
    Apr 2003
    Location
    Greenville, SC (USA)
    Posts
    1,155
    sqlldr.exe userid=username/password@sid control=.... log=.... bad=..... discard=.... ROWS=200 skip=1

    skip = xxx number of rows to skip before starting the load ...

    HTH
    Gregg

  5. #5
    Join Date
    Feb 2004
    Location
    New York
    Posts
    45
    Originally posted by gbrabham
    sqlldr.exe userid=username/password@sid control=.... log=.... bad=..... discard=.... ROWS=200 skip=1

    skip = xxx number of rows to skip before starting the load ...

    HTH
    Gregg

    It did worked, but data was inserted in a horrible format,
    instead of load data into two columns it loaded all to one.

    Is there a way to fix it????

    Thank you/

  6. #6
    Join Date
    Apr 2003
    Location
    Greenville, SC (USA)
    Posts
    1,155
    Ensure that you have comma separated files (or tab delimited) then

    into Table tablename
    FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
    TRAILING NULLCOLS
    (
    TermsCode char,
    Description char)

    HTH
    Gregg

  7. #7
    Join Date
    Feb 2004
    Location
    New York
    Posts
    45
    Originally posted by gbrabham
    Ensure that you have comma separated files (or tab delimited) then

    into Table tablename
    FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
    TRAILING NULLCOLS
    (
    TermsCode char,
    Description char)

    HTH
    Gregg

    I did fix it and its WORKING

    Thank you

    Y

  8. #8
    Join Date
    Apr 2003
    Location
    Greenville, SC (USA)
    Posts
    1,155
    Glad to be of assistance ...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •