Error: Source contains no datarows

Hi, I know there are some forums with similar issues. But it still does not solve my issue. I am trying to read range and it shows this error. But when I try the same activity in a different project it works. and my excel file does have datarows and not empty for sure. This error shows before i even filter thus it’s nothing with my schema i suppose. I even tried reinstalling UiPath.excel.activities. Do suggest what i can about this error.

CloneMain has thrown an exception

Source: Assign

Message: The source contains no DataRows.

Exception Type: InvalidOperationException

System.InvalidOperationException: The source contains no DataRows.
at System.Data.DataTableExtensions.LoadTableFromEnumerable[T](IEnumerable1 source, DataTable table, Nullable1 options, FillErrorEventHandler errorHandler)
at System.Data.DataTableExtensions.CopyToDataTable[T](IEnumerable1 source) at lambda_method(Closure , ActivityContext ) at Microsoft.VisualBasic.Activities.VisualBasicValue1.Execute(CodeActivityContext context)
at System.Activities.CodeActivity1.InternalExecuteInResolutionContext(CodeActivityContext context) at System.Activities.Runtime.ActivityExecutor.ExecuteInResolutionContext[T](ActivityInstance parentInstance, Activity1 expressionActivity)
at System.Activities.InArgument1.TryPopulateValue(LocationEnvironment targetEnvironment, ActivityInstance activityInstance, ActivityExecutor executor) at System.Activities.RuntimeArgument.TryPopulateValue(LocationEnvironment targetEnvironment, ActivityInstance targetActivityInstance, ActivityExecutor executor, Object argumentValueOverride, Location resultLocation, Boolean skipFastPath) at System.Activities.ActivityInstance.InternalTryPopulateArgumentValueOrScheduleExpression(RuntimeArgument argument, Int32 nextArgumentIndex, ActivityExecutor executor, IDictionary2 argumentValueOverrides, Location resultLocation, Boolean isDynamicUpdate)
at System.Activities.ActivityInstance.ResolveArguments(ActivityExecutor executor, IDictionary`2 argumentValueOverrides, Location resultLocation, Int32 startIndex)
at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)

Like i said above, i tried looking at the forum. but it doesn’t help me.

Thank You xoxo

Its failing at your assign activity in your For Each Row activity

Do you have a screenshot of that?

Follow below link

@indra it’s not about my schema


This error occurs when you are trying to convert an Enumerable(Of Datarow) to a datatable when this one actually contains no row.

You probably are doing something as follow:

dt.Select(“[Name]=‘X’”).CopyToDataTable but no rows with ‘X are found’, So at the moment you are trying to convert your Enumerable with 0 rows, it fails.



@Florent_Salendres Hi yes, im using something like that

cdr.Select(“Client=”+"‘“+serverName+”’ ").CopyToDataTable

cdr.Select(“Client =”+“'”+clientName+“'”+" and Agent = ‘Windows File’ and Type = ‘FULL’ and [Type] = 'Weekly '").CopyToDataTable

is the line wrong?

It seems to be syntactically correct, however are you sure that before converting to datatable, the condition you have on your Selects have matching results?

If at one point the do not, it will throw the exception.
One way you can handle it is using

If cdr.Select(“Client=”+"’ “+serverName+” ’ ").Any() Then




Actually there is a star * beside ’ . As to get the next word togather.
cdr.Select(“Client=”+"’“+serverName+”’ ").CopyToDataTable
After I tried one by one, I found out the problem is with the star
I tried using % also cannot. Is any other way around?

[quote=“Florent_Salendres, post:7, topic:60360”]

I have had success using ‘Like’ as the operator instead of ‘=’ when using wildcards.

cdr.Select(“[Client] Like '”+serverName+“'”).CopyToDataTable

1 Like