How to put array of data row into a data table?

thank you.

@Venkatesh_Chowdary, Refer this,

Regards,
Dom :slight_smile:

1 Like

Hi @Venkatesh_Chowdary ,

Use add data row to add the data array into datatable.

Use for each to loop through the array of data row. And add the data into datatable.

Regards,
Arivu

2 Likes

@Venkatesh_Chowdary

Datatable DT=DataRowArray_Variable.CopyToDataTable()

Regards,
Mahesh

1 Like

Hello Mahesh,

I want to ask you the opposite. I want to create array of strings for each row in Excel datatable and could not find appropriate post for it. Could you please help ?

Best,

@oduzen001

Read Excel Sheet and store it in a datatable dta

Now create a Variable ABC which is of datatype List(Of List(Of Strings))

ABC = (From p In dta.Select
           Select p.ItemArray.ToList).ToList

p represents each row of datatable dta
and we are converting each row to a list of strings.
So ABC is List of List of strings.

So if you access ABC(0) you will get a list of strings which is of row 0.

Regards,
Mahesh

1 Like

.copytodatatable() throws error for me :frowning:Capture

Hi @AnirudhGoswami

What is the error when you hover over the blue exclamation mark?