Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

How to read from a text file using a programming tool?

I have a series of text files that all have the same format. I need to read the same point in those files (i.e in the 3rd row, spaces 12 to 15) and then save the corresponding data to an excel sheet, in specific cells.

Does anybody know if this possible by Visual Basic or is there another way?

Update:

I'm looking for the VB CODE that will do that task automatically. I have around 1000 text files, so copy-paste is not an option.

3 Answers

Relevance
  • 1 decade ago
    Favorite Answer

    It is possible with VB or VBScript to do what you are looking for. You can read a specific entry from a text file (specific line and specific column numbers) and it is then possible to open an Excel object to a specific sheet and put the collected input to a cell.

    My question back to you would be how do you now (manually) determine which text file entry corresponds to which Excel spreadsheet cell? Is there something in the text file filename that would indicate which page/cell it is entered into?

    I have included some links to Microsoft sources that show examples of what you are trying to, though you would have to piece your solution together (it doesn't write a solution for your problem, but it does give the foundational skills to be able to accomplish it).

  • Anonymous
    1 decade ago

    You can directly open the file in excel (open with) and it will ask you to divide the contents into cells.

    or

    You can write a php program whill read a file, does a find and creates a .csv file which can be imported into excel sheet.

  • carris
    Lv 4
    5 years ago

    you're no longer reading categories of documents, yet only text textile chars it may seem. the only trouble is which you're able to have the potential to forget approximately approximately areas, commas, carriage returns, and parenthesis as white area separators, mutually as recognizing multi char strings whilst there is no white area or separators. So usually you have 2 nested mutually as loops. the 1st is going until eof, to technique all the information, each and every chew going right into a distinctive string of the string array. the 2d is the only that gets all the char in one string. it is going to first pass over any white area or separator, until it gets a sturdy commencing char. Then it keeps accumulating until it hits a white area or separator, which terminates the string and ends the interior loop. bear in strategies that strings are only an array of chars, to be certain that this reason this is a 2 dimensional array of chars you're filling.

Still have questions? Get your answers by asking now.