Seeing "Cannot serialize the DataTable. DataTable name is not set " Error even after setting datatable name

I’m seeing this error:

System.InvalidOperationException: Cannot serialize the DataTable. DataTable name is not set. at System.Runtime.AsyncResult.End[TAsyncResult](IAsyncResult result)
at System.Activities.WorkflowApplication.IdleEventHandler.OnStage2Complete(IAsyncResult lastResult, WorkflowApplication instance, Boolean isStillSync)
at System.Activities.WorkflowApplication.EventFrame(IAsyncResult result)

in a Write Range Workbook activity.

To troubleshoot this, I have set the datatable name before the activity using:

dtTable.TableName = “Table”

I have added a log message to verify that the name is indeed captured by UiPath.

Any ideas on how I can resolve this? I have tried UiPath.Excel.Activities package versions 2.16.4 and 2.20.3

@benjiherb,

There is no need of naming the datatable to use it into Write Range activity.

Just configure like this and it should write the data to Excel file.

image

Thanks,
Ashok :slight_smile:

Not sure if you read the post, but I’m getting an error saying the datatable needs to be named.

How is dtTable created? Did you use Build Data Table?

@benjiherb,

May be show some code like from where your datatable coming from and how you are passing it.

Thanks,
Ashok :slight_smile:

Hey @benjiherb

Can you share the screenshot error ?

Cheers :upside_down_face:

It’s initially read from a CSV file and there is quite a bit of data manipulation before writing the range to a workbook.

I tried to recreate the error by creating a data table without a name but Write Range Workbook on my computer doesn’t have any issue with it. Whatever is causing the issue might not have anything to do with the table name.

image

@benjiherb,

Try upgrading the package if not up to date.

In Object Cannot serialize the DataTable. DataTable name is not set ” Error even after setting datatable name
I’m seeing this error:
System.InvalidOperationException: Cannot serialize the DataTable. DataTable name is not set. at System.Runtime.AsyncResult.End[TAsyncResult](IAsyncResult result)

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Cannot serialize the DataTable. DataTable name is not set your data table do not have any Name.
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Solution: dtTable.TableName = "Table" the you deseralized it

@benjiherb It will solve your issue.

dtTable.TableName = “Table” was the first thing I tried, as stated by my original post. It didn’t work.

Hi,
works fine in my case. Maybe try to create the variable directly, not via assign:

Use “Build Datatable” activity
And in Datatable name create a variable, which is then your datatable name.
Press Ctrl + K to auto create variable with correct type.

image