How to populate into the template CSV that has main header (columns) and detail (Columns)

Hi,
I just wanted to know how I can populate csv file with having Main and detail columns as you can see in the below screenshot.

Can anyone help me? Thanks!

Hi @Sisay_Dinku

For this create two different datatable and fill your data and at last add blank columns to the second datatable and then merge them together and then write to csv

Or with out merging you can use append as well

cheers

@Anil_G I did not capture the whol process you are trying to explain. Could you put into example, please? Thanks

Hi @Sisay_Dinku

Please find below


Add data column step must be repeated 5 times as you have 5 extra columns

And make sure you add the first row of your 3 column datatable(Second datatable ) with header details. The first row should be the header so that when merged even header is considered as row because it is added as the first row

cheers

Hi @Sisay_Dinku

Please see attached xaml and the output I did it with 2 and 1 columns you can replicate it for your scenario

Mergecsv.xaml (10.6 KB)
test.zip (2.1 KB)

Hope this helps

cheers

@Anil_G thank you for I was able to do that through direct codes by juest changing the row indexes. However, all of the sudden I have found this error

Hi @Sisay_Dinku

According to the error there is no row at some index you have given but you are trying to access that row… so please check if your datatable has enough rows.

Cheers