I want to write a template file (*.tt) to write data to an XLS file in C#. How can I write the data in separate columns? For example I want to an excel file with 3 column as below
column1 column2 column3
sss ttt rrr
www qqq aaa
but I can't insert them in separate column
<#= "sss " #><#= "ttt " #><#= "," #><#= "rrr" #>
<#= "www " #><#= "qqq " #><#= "," #><#= "aaa" #>
and the output in excel file is like this
column1
sss ttt rrr
www qqq aaa
and all data are inserted at the first column
If you opt for using Excel Interop, then following is a demonstration of putting data in separate columns of an Excel worksheet. You can refer this for more details on Excel Object model reference.