How to make datatable with variable number of columns?

datatable

#1

I’m making a datatable, but the number of columns and rows needs to be different from one run to the next. How do you make a datatable where the number of columns is a variable?


#2

@stefan count the number values in array or any other thing. Use loop, inside it use add data column for each values. Based on values u number of values u get, different number of columns are created.


#3

So there is no way of making the datatable ‘‘directly’’?
Like New DataTable(x_rows, y_columns)


#4

@Stefan1 i dont have knowledge about that.


#5

Okey, thank you!


#6

DataTableSample.xaml (7.6 KB)

Here you go, please check the sample. :+1:


#7

@bala_subramanyam great, thank you!


#8

if it helps you, please mark it as a solution


#9

Append range is your friend.

Check this out

Append Range