Computer Hope

Microsoft => Microsoft DOS => Topic started by: ryb on February 01, 2017, 05:08:29 AM

Title: batch file to convert text file into excel
Post by: ryb on February 01, 2017, 05:08:29 AM
Hello Guys,
Very new to this forum
I need to have a batch file program  which converts text file into Excel format
as an example the contents will have 3 lines as below:
1|0|32|1|1|2|0|0|1|0|0|2222|0|0|0|0|20170130151125|20170130151210|
2|0|32|1|1|2|1|1|1|2222|1000|2222|0|0||0|20170130151125|20170130151210|
10000|0|32|1|1|2|NULL|0|0|0|0|0|0|0|0|0|20170130151125|20170130151210|

the 2nd line needs to be address importantly for further processing.




Thanks
Rajesh
Title: Re: batch file to convert text file into excel
Post by: strollin on February 01, 2017, 07:18:17 AM
If I understand your question correctly, you don't need any form of batch file.  You can use the Data import function of Excel to import the data.  You will need to setup the delimiter as the '|' character since it is used in your text file to separate the data values.

What version of Excel are you using?
Title: Re: batch file to convert text file into excel
Post by: Squashman on February 01, 2017, 07:24:09 AM
Batch files cannot read or write excel files.  If you need to read or write excel files then use  Vbscript, Jscript or Powershell.
Title: Re: batch file to convert text file into excel
Post by: soybean on February 01, 2017, 08:39:53 AM
Batch files cannot read or write excel files.  If you need to read or write excel files then use  Vbscript, Jscript or Powershell.
Your logic is backward.  He does not need a batch file to read or write Excel files.  He needs to know how to import data into Excel. 
Title: Re: batch file to convert text file into excel
Post by: Squashman on February 01, 2017, 08:56:15 AM
Your logic is backward.  He does not need a batch file to read or write Excel files.  He needs to know how to import data into Excel.
No. I import (write) text files into excel all the time with Vbscript.  There is nothing illogical about it.
Title: Re: batch file to convert text file into excel
Post by: Salmon Trout on February 01, 2017, 11:56:33 AM
I import (write) text files into excel all the time with Vbscript.  There is nothing illogical about it.
Absolutely.