cancel
Showing results for 
Search instead for 
Did you mean: 

Converting Txt file into Excel

Hi Team,

How can we convert the txt file into an Excel file?
1 BEST ANSWER

Best Answers

Hi

This can be done with the excel utility as you would do with any excel file. If you create an instance then use open workbook and set the filename to be your text file e.g. "C:\Users\miconeil\Documents\mytextfile.dat" and the file will open in excel then just use the excel utility to save the file as an excel file.

Hope this helps

View answer in original post

7 REPLIES 7

EmersonF
MVP
Hi Murali, Fine, it's been a while since I came here, but have you considered importing the TXT into the excel file?
Link Guide:Import or export text (.txt or .csv) files (microsoft.com),let me check if i have something ready for this 😄

#Edit 
JSFiddle - Code Playground
Just download and save as .bpobject​​
Sr Cons at Avanade Brazil

ewilson
Staff
Staff
Is the txt file actually a CSV? If so, there is an Import CSV action on the Excel VBO.

If not, the question becomes what is your expectation for what the txt file contents will look like in Excel. It's pretty easy to just read the contents of a text file and then insert the entire contents into a cell in a worksheet.

You could also look at reading the contents of the txt file, push that data into a BP Collection (ex. line by line) and then use the Write Collection action on the Excel VBO to write the contents of the Collection into a worksheet.

I'm sure there are various other methods.

Cheers,

Thanks Emerson for your reply, I was looking if there is any inbuilt solution for that.

HI @ewilson,
It's not CSV, instead its DAT file​.

On the process flow, we download it from an external source, and later we need to convert it to excel for further operations.

For now we are doing it like- Open the DAT file with notepad >>Copy complete>>Paste it on a new Excel Wokbook>> Convert text to Columns (to populate correct data in all columns )

EVIPUTI
MVP
@krishna.kodimurali9
Someone helped me before with this which is simply changing filetype , not sure if this helps you but worth a try :

Dim objFile As New System.IO.FileInfo("path\filename.dat")
objFile.MoveTo("path\filename.xls")
------------------------------ Vipul Tiwari Senior Process Simplification Developer Amazon ------------------------------

richieadam
Level 2
Is the txt file actually a CSV?

If so, there is an Import CSV action on the Excel VBO.

If not, the question becomes what is your expectation for what the txt file contents will look like in Excel.

It's pretty easy to just read the contents of a text file and then insert the entire contents into a cell in a worksheet.

You could also look at reading the contents of the txt file,

push that data into a BP Collection (ex. line by line) and then use the Write Collection action on the Excel VBO to write the contents of the Collection into a worksheet.

I'm sure there are various other methods.
......................................................
Ornament Central

Hi

This can be done with the excel utility as you would do with any excel file. If you create an instance then use open workbook and set the filename to be your text file e.g. "C:\Users\miconeil\Documents\mytextfile.dat" and the file will open in excel then just use the excel utility to save the file as an excel file.

Hope this helps