copyToDataTable error

While doing this expression(ExtractDataTable.Select(“Type = ‘WI2’ and Statue = ‘Open’ and Date > ‘2018-01-01’”).CopyToDataTable)
Am getting CopyToDataTable is not a part of System.Array

Per this stack overflow thread, it is an extension method in the DataTableExtensions class.

You need to import System.Data.DataSetExtensions.

Am not getting “System.Data.DataSetExtensions” in import pannel

You can download the nupkg from here and then place it into C:\Program Files (x86)\UiPath\Studio\Packages. You’ll probably need to restart Studio once you’ve copied the nupkg to the directory.

1 Like

@prasad555

Here, ExtractDataTable is what type of variable ?

DataTable Type

1 Like

@prasad555 you can also copy rows over like this:

foreach (DataRow row in rowArray) {
   dataTable.ImportRow(row);
}

Just use the UiPath for each row activity.

After Import am getting an error like

@prasad555
That’s alright we can add the items a different way with Invoke Method activity.

Loop through your array of DataRow objects and for each one you can use the ImportRow method to add the row to your DataTable (mine is called dtResults).

@prasad555,

Update excel activity package & restart Studio. I had same issue for a different version of Excel package.

Hi @prasad555, i just modified your code.

Try the below code.
ExtractDataTable.Select(“[Type] = ‘WI2’ and [Statue] = ‘Open’ and [Date] > ‘2018-01-01’”).ToArray.CopyToDataTable()

Make sure ‘ExtractDataTable’ Variable’s data type was Datatable.

TanQ,
Michael Udhaya