+ Reply to Thread
Results 1 to 10 of 10

import tab delimited text files into excel but skip first 5 lines

  1. #1
    Registered User
    Join Date
    11-27-2011
    Location
    Bucharest, Romania
    MS-Off Ver
    Excel 2003
    Posts
    9

    import tab delimited text files into excel but skip first 5 lines

    Is there a way to import into Excel a tab delimited text file but skip the first 5 lines?
    The file has up to 91 columns
    Also I would like to import only certain columns let's say column 3, 5 and 9.
    Attached is an exmple of the file that I would like to import into excel.
    Thanks in advance for your help.
    Attached Files Attached Files
    Last edited by alexbotea2005; 11-28-2011 at 05:29 PM.

  2. #2
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: import tab delimited text files into excel but skip first 5 lines

    Hi alexbotea2005
    Welcome to the forum

    the easy was is to use the recorded macro are the change the start row to 5
    Please Login or Register  to view this content.
    Last edited by pike; 11-27-2011 at 06:17 AM. Reason: add 'change to five
    If the solution helped please donate to RSPCA

    Site worth visiting: Rabbitohs

  3. #3
    Registered User
    Join Date
    11-27-2011
    Location
    Bucharest, Romania
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: import tab delimited text files into excel but skip first 5 lines

    Thanks for your help, the script that you've sent works fine. If possible I would like to be able to import only certain columns of the text file in column B, E and G. I was trying to use the bellow code:

    Please Login or Register  to view this content.
    I don't know how to tell the script to skip first 5 lines and to split each textline by tab.

  4. #4
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: import tab delimited text files into excel but skip first 5 lines

    Please Login or Register  to view this content.



  5. #5
    Registered User
    Join Date
    11-27-2011
    Location
    Bucharest, Romania
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: import tab delimited text files into excel but skip first 5 lines

    Thanks for your reply,
    The code that you’ve send imports the entire text file without header into a new workbook.
    I’m trying to add only couple columns from the text file to an existing workbook in columns A, B, C and G.
    To clarity, I have attached an excel file with to sheets:
    - “file1-original” : has the original text file imported manually and tab separated
    - “Data” : is the sheet where the data needs to be imported.
    Thanks,
    Regards
    Alex
    Attached Files Attached Files
    Last edited by alexbotea2005; 11-27-2011 at 05:45 PM.

  6. #6
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: import tab delimited text files into excel but skip first 5 lines

    or just replace the ones with 9 in the column you dont need

    Please Login or Register  to view this content.

  7. #7
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: import tab delimited text files into excel but skip first 5 lines

    should have been
    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    11-27-2011
    Location
    Bucharest, Romania
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: import tab delimited text files into excel but skip first 5 lines

    The above script worked perfect for a blank sheet. Only problem is that the sheet I need to update has other formulas / data between the columns that are filled in from the text file (see Import-text-file.xls file “Data” sheet - that was attached on a previous post) and array puts all the columns one next to each other.
    Best Regards
    Alex

  9. #9
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: import tab delimited text files into excel but skip first 5 lines

    Hi alexbotea2005
    The problem is that its a file1 should be saved as a csv file
    you can open in in excel as save as a csv file or change the extention
    then this will do the trick

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by pike; 11-28-2011 at 06:26 AM.

  10. #10
    Registered User
    Join Date
    11-27-2011
    Location
    Bucharest, Romania
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: import tab delimited text files into excel but skip first 5 lines

    It's a good starting point from which I will have to figure out how to implement it.
    Thanks for your time,
    Best Regards
    Alex

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1