Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2004
    New York

    Unanswered: xls to csv using bat file

    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...


    Thanky you.


  2. #2
    Join Date
    Apr 2004
    Bothell, WA

    why not build a macro

    I'm no whiz at batch files, but what you're trying to do sounds like it should be easy to do as a macro. If you want it to be configurable, or save the file in a specific location you could do that in the VBA code, but if you just want to grab the same set of cells, delete the top row and save it as a csv file then try this code (you can modify the file location to fit your needs):

    Sub csvsaver()

    Application.CutCopyMode = False
    Selection.Delete Shift:=xlUp
    ChDir "C:\Documents and Settings\Default\Desktop"
    ActiveWorkbook.SaveAs Filename:= _
    "C:\Documents and Settings\Default\Desktop\Book1.csv", FileFormat:=xlCSV, _

    End Sub

Posting Permissions

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