How to Add Multiple Data Columns To A Datatable At Once?



Is it possible to do something like this?



Hi @whyyouandi,

Its not possible instead of this you can add from the build data table it self you can add the columns



Hello @arivu96, I was trying to add columns to an existing data scraping data, so I cannot use Build Data Table. But thank you for mentioning that it is not possible to do that at once :slight_smile:


Hi @whyyouandi,

You can use multiple add data column activity.



Yes, thank you.


@whyyouandi, You can add multiple columns in datatable using AddRange method.

Need to use Invoke Method

TargetObject - datatable Variable.Columns
MethodName - AddRange
Parameters - 
IN - DataColumn[] - { new DataColumn ("columnName1"), new DataColumn ("columnName2") }

Dom :slight_smile:


HI @whyyouandi,
Good Idea @Dominic,
Its working fine
AddMultipleDataColumn.xaml (10.0 KB)


Get column name from first row in DataTable
How to add custom headers and data in Write CSV

Thank you @Dominic, exactly what I wanted! Always thank you! :star_struck:

And thank you @arivu96 for assembling it into .xaml, would have struggle without it!
(Set the solution to the arivue96’s one since I think the end result will be easier to be understood for anyone reading this thread if any).