Results 1 to 2 of 2
  1. #1
    dr_patso is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jul 2011
    Posts
    4

    csv import second row contains column headings

    I have a process I need to automate.

    I have been manually deleting the first row on the CSV since it just contains the CSV title and the second row actually contains column headings

    so the checkbox for first row contains column headings is sadly useless to the original file..



    any remedy for this? can I delete the first row upon import or something to fix this automatically?

  2. #2
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    you can use the filesystemobject utility to remove the first line of the CSV or even the first two if you don't care about your header row.

    Let's say you have a file named

    c:\TestImport.txt

    you would use this:
    Code:
    Dim fInput
    Dim fOutput
    Dim fs
    Dim sline As String
    
    Set fs = CreateObject("Scripting.filesystemobject")
    Set fInput = fs.opentextfile("c:\input.txt")
    Set fOutput = fs.createtextfile("c:\output.txt")
    
    sline = fInput.readline 'if you want to skip the first line
    
    Do While fInput.atendofstream <> True
        sline = fInput.readline
        fOutput.writeline sline
    Loop
    to delete the first row.

    Then of course if you had a series of files you wanted to do this with all in the same folder you could use the filesystemobject to cycle through all those files too.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 12
    Last Post: 09-13-2012, 12:07 PM
  2. Blank column causing errors on import
    By brickballer in forum Import/Export Data
    Replies: 7
    Last Post: 05-20-2011, 12:54 PM
  3. Resizing column headings
    By allykid in forum Access
    Replies: 0
    Last Post: 03-10-2011, 12:58 PM
  4. Get column headings from closed Workbook
    By Deutz in forum Access
    Replies: 1
    Last Post: 12-10-2010, 09:06 AM
  5. Cross Tab Column Headings...
    By mhoctober in forum Queries
    Replies: 3
    Last Post: 09-10-2010, 01:21 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums