+ Reply to Thread
Results 1 to 16 of 16

Text To Excel

  1. #1
    Registered User
    Join Date
    01-04-2011
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    9

    Smile Text To Excel

    hi Everyone

    I basically have a large text file and I want to convert into Excel exactly as I have attached both text & excel files here.
    Can anyone help me how can I convert/import this 'text' file into Excel
    P.S.: Please note that text file data is too large this is just sample so I can't do 'tab' settings.
    any other shorter way if anyone know would be highly appriciated

    Thanks
    Rocky
    Attached Files Attached Files
    Last edited by pike; 02-03-2011 at 02:46 AM.

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

    Re: Text To Excel

    Hi Rocky
    can you check the text file as the data has different layouts
    Is the data grouped over four or five lines?
    If the solution helped please donate to RSPCA

    Site worth visiting: Rabbitohs

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

    Re: Text To Excel

    Hi Rocky
    with out knowing the possible data layouts something like this
    Please Login or Register  to view this content.
    Last edited by pike; 01-05-2011 at 07:01 AM. Reason: add Cells(10 + xRow, xCol).Value = xValue

  4. #4
    Registered User
    Join Date
    01-04-2011
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: Text To Excel

    Thnks very much Pike for your reply & the suggestion.
    And yes you are right. text file data are grouped over four or five lines.
    In text file you can see that data is starting with "MD-DD-XXXXXX" & ending with "1 TO 2 YEARS," and total no. of data for one entry/raw is 26. i.e. in excel the data should be imported from A1 to Z1, A2 to Z2, A3 to Z3............and so on.
    I hope you can understand & for your complete knowledge I am attaching herewith a sample of Text file that contains 147 Data. In text file you will see as I have written above the
    Entry no. 1 starts with MD-DD-030000, XC-DD-25001,SN1OOOO25001,.................1 TO 2 YEARS (Total 26 columns)
    Entry no. 2 starts with MD-DD-030001, XC-DD-25002,SN1OOOO25002,.................1 TO 2 YEARS (Total 26 columns)
    ........................................................................
    .......................................................................
    Entry no. 147 starts with MD-DD-030146, XC-DD-25147, SN1OOOO25147,.................1 TO 2 YEARS (Total 26 columns)

    Now I want to convert this 147 Entries into Excel & for your ready reference I am attaching sample of excel file(1st 3 entries) as what exact data I want to be imported all 147 entries into excel, I have also given the Titles to all 26 columns maybe that can help out in importing.

    I am awaiting your reply.

    Thnks & Rgds
    Rocky
    Attached Files Attached Files

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

    Re: Text To Excel

    Hi rocky
    This will just add the text file to the worksheet per 4 or five grouping but there are to many variables to work out what goes where
    How do you create the text file? If you could add the delimiters to the text file it would be easier
    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    01-04-2011
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: Text To Excel

    Thanks very much Pike for your reply.
    I have tried your last code but sorry it didn't worked!
    Well the original file is PDF and I have converted into text. The data of text file is too large so adding delimiters or applying tab will take too long time!
    But one common thing is that there are exactly 26 columns in each entry( you can see the excel file i have attached earlier)

    Thanks
    Rocky

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

    Re: Text To Excel

    Hi Rocky
    conversion from PDF is a problem as there is no real pattern to follow; Its near impossible to allow for all the variations in the layout.
    The PDF is created from a word document?

  8. #8
    Registered User
    Join Date
    01-04-2011
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: Text To Excel

    Well Pike I have some softwares that can easily turn any pdf into word exactly the data as it is. and not only pdf , like jpg files can also be converted to word easily.
    And i really don't know that pdf is created from word, cuz I hv rcvd. pdf.
    Tell me if you want to see the pdf, i will attach it.
    thnks
    Rocky

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

    Re: Text To Excel

    Hi Rocky
    veiwing the pdf won't help.. it just the way the data is layed-out.. to many variables to capture them all fro the table..
    Can you control how the data is inputed?

  10. #10
    Registered User
    Join Date
    01-04-2011
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: Text To Excel

    Pike , well I really don't know how the data is inputed into pdf, but I think maybe through some software or programme.
    Rgds
    Rocky

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

    Re: Text To Excel

    Hi rocky2011
    change the file path name to the txt files and this will take out another variable
    Please Login or Register  to view this content.

  12. #12
    Registered User
    Join Date
    01-04-2011
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: Text To Excel

    Hi Pike,
    Sorry but last code didn't work at all. I rcvd. a blank file in excel.
    And I am applying correct file path and that is c:\147.txt
    For your ready reference I am enclosing both 147 txt & 147 excel files
    so that you can workout more on it.

    thnks very much
    Rocky
    Attached Files Attached Files

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

    Re: Text To Excel

    Hi rocky2011,
    147.txt has another different layout with added line breaks
    since the txt file was made from a PDF I'm afraid it is not practical to convert it to the table you require

  14. #14
    Registered User
    Join Date
    01-04-2011
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: Text To Excel

    Hi Pike,
    I have attached a new text of 147 entries in a different format. Where you will see that each entry is seperated by a comma, can you please take a look on file and give me your feedback?
    Thnks very much
    Rocky
    Attached Files Attached Files

  15. #15
    Forum Expert
    Join Date
    03-31-2009
    Location
    Barstow, Ca
    MS-Off Ver
    Excel 2002 & 2007
    Posts
    2,164

    Re: Text To Excel

    Hi Rocky;

    I don't work with text files, but since you asked me to look at it I'll try.
    This code DEPENDS on a "," being at the end of each line and a SPACE, or CR or LF to separate the text for each column.

    I tried it on "new 147.txt" and it worked fine, but I don't see any reason why it would not work on any of the formats you have uploaded.

    Please Login or Register  to view this content.
    Foxguy

    Remember to mark your questions [Solved] and rate the answer(s)
    Forum Rules are Here

  16. #16
    Registered User
    Join Date
    01-04-2011
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    9

    [Solved] Re: Text To Excel

    Thnx very much Pike, its worked correctly. For larger data also this will work although I have to make some changes in text file. Thanks again for your help.
    Rocky

+ 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