Click here to Skip to main content
15,887,477 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi Community -

I have hundreds of text files that have one item line by line:

Example

Open:
FirstName: Joe
LastName: Smith
Age: 32
State: Ohio
End:
Open:
FirstName: Mike
LastName: Watkins
Age: 54
State: New Jersey
End:

And what I need to do is parse out the text files and put them in one row of an excel sheet so it looks like:

Column A Column B Column C Column D
Joe Smith 32 Ohio
Mike Watkins 54 New Jersey

Now, parsing out to an excel file - there are multiple explanations on google, however, i am not sure how to parse out after the : symbol and put on one line for anything from Open: to End:

Are there any resources about this that anyone knows of or can help?

Thanks in advanced.

daveofgv
Posted
Comments
Sergey Alexandrovich Kryukov 28-Jan-16 11:07am    
Yes, there are resources and many could help. You can get help only if you call for help. How? You can ask a question on this forum. I already answered your question, but this wasn't a question on the topics of this forum. Probably you need to ask another one... :-)
—SA
Andreas Gieriet 28-Jan-16 11:26am    
As far as I know, there is no intrinsic support for this in Excel. You can transpose records in Excel, but this does not help if you have larger files and hundreds of files as you say.
So, you might need some tool to convert the text into some CSV file.
Can you program such a tool (e.g. do you know programming C# or any other language)? If yes, what is the problem? If no - too bad... (this forum is not to ask for the service to build a tool for you).
Cheers
Andi
ZurdoDev 28-Jan-16 11:50am    
There is no magic bullet that will do it for you. The easiest way, I think, is to read in each line one at a time. When you get to Open: you increment the row number you are writing to in excel. And then one line at a time you dump into a spreadsheet.

1 solution

The simplest way would be to create a .csv file from your inputs. Excel can then read the csv and convert it directly to spreadsheet format. Alternatively you could use the Excel Interop, but that is much harder to work with.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900