Output to excel/csv file

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
A_Bobby
Posts: 38
Joined: 21 Oct 2010 12:48

Output to excel/csv file

#1 Post by A_Bobby » 24 Aug 2011 09:13

Hi,

Trying to export output from different variables to different columns of Excel or csv file. Is that possible? Tried to look in the forum but could not find it.

e.g.

@echo %var1% %var2% %var3% >> whatever.xlsx

where the variable values of three variables should end up in A1, B1 and C1 cells.

Thanks,
Bobby

trebor68
Posts: 146
Joined: 01 Jul 2011 08:47

Re: Output to excel/csv file

#2 Post by trebor68 » 24 Aug 2011 10:56

With following code you will write the value to the csv file.

Code: Select all

@echo off
set dat=Test.csv
set vara=Anton
set varb=Berta
set varc=Caesar
echo "letter A","%vara%">%dat%
echo "letter B","%varb%">>%dat%
echo "letter C","%varc%">>%dat%
echo.>>%dat%
echo ,"three">>%dat%


"CSV" is comma seperated value
With the test batch can you save this row by row.

A_Bobby
Posts: 38
Joined: 21 Oct 2010 12:48

Re: Output to excel/csv file

#3 Post by A_Bobby » 24 Aug 2011 12:45

Thanks! Even though it was not the output I had intended but it gave me the right direction

Post Reply