Excel write range hangs when datatable updated?

Hi

First post from a noob here.

This is what I want to do

  1. Read data from an Excel workbook to a datatable variable.

  2. Do some looping (the logic is not important here) and update the last column of the datatable. This uses an assign action like row(“Result”) = some string value.

  3. Use write range to output the updated datatable to a new Excel workbook

Sounds simple. My problem is that it just hangs at step 3. I have to kill Excel with task manager.

Using Output Data Table to view the updated table as a string shows that the last column is correctly updated.

When investigating, I found that writing to new workbook works Ok when the datatable is unchanged. This suggests that the issue is because I have updated the datatable and perhaps changes need to be commited?

I also tried the following:
A. Use a clone of the datatable for write range. This doesn’t hang, but the data does not contain the required changes.

B. I added an Invoke method to call the AcceptChanges method on the datatable before write range. This still hangs.

Help much appreciated

best regards
John

The auto numbering corrupted on first attempt. Below is step 3.

Step 3: Use write range to output the updated datatable to a new Excel workbook

Hi,
I was able to “Write Range” after updating the datatable.
There’re two “Write Range” activity in UiPath but both works fine.

See my sample flow and please let me know if I misunderstand what you want to do.
WriteRangeAfterUpdatingDatatable.zip (10.3 KB)

I recommend you to upload your xaml file if possible so that more knowledgeable members can easily offer you help :slight_smile:

Hi a-taniya,

Thank you for your prompt and informative example.

On examination, I was assigning a datatable value from a generic data type. The hanging issue was fixed once I appended .ToString to the variable assignment to update the column value.

best regards
John