I have an excel file with 5 values each in a line. now, i want to read the .csv file through batch file and create text file with the contents in the file. Example, if i hav
there are a lot of similar questions answered in SOF. Few of them to refer are :
Reading from a csv file and extracting certain data columns based on first column value
Help in writing a batch script to parse CSV file and output a text file
How do you loop in a Windows batch file?
Simplest answer is to loop thru your file using:
FOR %A IN (list) DO command [ parameters ]
Example:
Sample CSV:
0,1,2,4
1,1,2,3
2,2,4,6
3,3,6,9
bat file content:
for /f "usebackq tokens=1-4 delims=," %%a in ("sample1.csv") do (
echo %%a %%b %%c %%d )
here tokens=1-4 meaning that we wish to read 4 column data for each line