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

Is it possible to do something like this?

image

2 Likes

Hi @whyyouandi,

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

Regards,
Arivu

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.

Regards,
Arivu

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") }

Regards,
Dom :slight_smile:

3 Likes

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

Regards,
Arivu

6 Likes

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).

2 Likes