+ Reply to Thread
Results 1 to 4 of 4

Import second line of text file to spreadsheet

  1. #1
    Registered User
    Join Date
    06-14-2013
    Location
    Flagstaff,AZ USA
    MS-Off Ver
    Excel 2010
    Posts
    20

    Import second line of text file to spreadsheet

    Happy New Year Forum!

    This is my first post of the New Year. I seem to be having a hard time figuring out how to read a text file and import the second line of data into a spreadsheet. I have thousands of files that need to be opened and have the second line extracted. I want to point the code to a directory with the files and have the second line of data imported into a spreadsheet. Heres how i have started the code:

    Please Login or Register  to view this content.
    This code will identify if the files in the given directroy exist and will count the amount of files that need to be opened. Any suggestion on how have it loop through the files and read the second line of text.


    Thanks,


    Dubbdan

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Import second line of text file to spreadsheet

    Hello dubbdan,

    Can you post a copy of the text file?
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Registered User
    Join Date
    06-14-2013
    Location
    Flagstaff,AZ USA
    MS-Off Ver
    Excel 2010
    Posts
    20

    Re: Import second line of text file to spreadsheet

    Sure. Heres an example


    Dataset, Plane_Height, Reference, Z_Factor, Area_2D, Area_3D, Volume
    ..Output_data\eddy_047r_19950428, 819.56, ABOVE, 1.000000, 28471.298282803, 29268.357113616, 338772.94256509
    ..Output_data\eddy_047r_19950428, 819.66, ABOVE, 1.000000, 28471.226293285, 29268.275706257, 335925.81489252
    ..Output_data\eddy_047r_19950428, 819.76, ABOVE, 1.000000, 28470.983825915, 29267.999687093, 333078.70296627
    ..Output_data\eddy_047r_19950428, 819.86, ABOVE, 1.000000, 28470.394143228, 29267.312350817, 330231.63142235
    ..Output_data\eddy_047r_19950428, 819.96, ABOVE, 1.000000, 28469.545483403, 29266.319886041, 327384.63251627
    ..Output_data\eddy_047r_19950428, 820.06, ABOVE, 1.000000, 28468.214568561, 29264.792951364, 324537.74059707
    ..Output_data\eddy_047r_19950428, 820.16, ABOVE, 1.000000, 28466.741914318, 29263.072544246, 321690.99268645
    ..Output_data\eddy_047r_19950428, 820.26, ABOVE, 1.000000, 28465.178762521, 29261.215619611, 318844.39559346
    ..Output_data\eddy_047r_19950428, 820.36, ABOVE, 1.000000, 28463.449781379, 29259.155406891, 315997.96213763
    ..Output_data\eddy_047r_19950428, 820.46, ABOVE, 1.000000, 28461.439200733, 29256.789981578, 313151.71530643
    ..Output_data\eddy_047r_19950428, 820.56, ABOVE, 1.000000, 28459.181266002, 29254.143511634, 310305.68229145
    ..Output_data\eddy_047r_19950428, 820.66, ABOVE, 1.000000, 28456.203798207, 29250.707354337, 307459.90329267
    ..Output_data\eddy_047r_19950428, 820.76, ABOVE, 1.000000, 28451.757214522, 29245.664399654, 304614.49639759
    ..Output_data\eddy_047r_19950428, 820.86, ABOVE, 1.000000, 28446.439306219, 29239.644288462, 301769.57633447
    ..Output_data\eddy_047r_19950428, 820.96, ABOVE, 1.000000, 28439.760737395, 29232.098914186, 298925.25578972
    ..Output_data\eddy_047r_19950428, 821.06, ABOVE, 1.000000, 28431.710919635, 29223.006915455, 296081.67101248
    ..Output_data\eddy_047r_19950428, 821.16, ABOVE, 1.000000, 28421.65690188, 29211.742182868, 293238.97675117
    ..Output_data\eddy_047r_19950428, 821.26, ABOVE, 1.000000, 28409.24454665, 29197.885144466, 290397.41793222
    ..Output_data\eddy_047r_19950428, 821.36, ABOVE, 1.000000, 28396.208477709, 29183.266219719, 287557.1438264
    ..Output_data\eddy_047r_19950428, 821.46, ABOVE, 1.000000, 28382.175238601, 29167.621887724, 284718.20378271
    ..Output_data\eddy_047r_19950428, 821.56, ABOVE, 1.000000, 28367.024672139, 29150.800913017, 281880.75421307
    ..Output_data\eddy_047r_19950428, 821.66, ABOVE, 1.000000, 28352.898539258, 29134.916749655, 279044.76227975
    ..Output_data\eddy_047r_19950428, 821.76, ABOVE, 1.000000, 28338.696858118, 29118.887295627, 276210.17893165
    ..Output_data\eddy_047r_19950428, 821.86, ABOVE, 1.000000, 28322.831656898, 29101.044785776, 273377.08389981

    The first line contains headers and the following lines are comma delimited

  4. #4
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Import second line of text file to spreadsheet

    Hello dubbdan,

    My apologies for posting a solution that was not functional. This macro has been tested and includes alerts the user for folder not found or no matching files.
    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 0
    Last Post: 10-31-2012, 09:59 AM
  2. Import Text File Ddata Into Excel Spreadsheet - Multiple Columns & Rows
    By DOgburn in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-30-2012, 04:45 PM
  3. multi-line text file import to excel
    By Waxaholic in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-25-2006, 03:45 PM
  4. Import text file and create new spreadsheet
    By demianill in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-23-2006, 02:25 PM
  5. Import Text File Into A Spreadsheet with over 65,000 lines
    By Ecohouse in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-10-2006, 07:45 PM

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