Write Cell workbook Activity : The process cannot access the file its been used by other process

I’m Using Excel Application Scope inside that write cell activity it opens the excel and write the data.
Is there any other way to do without opening the excel?

and also i’m trying with the Write cell workbook its write the data ito the cell without opening but its stop at the middle and throws an error The process cannot access the file its been used by other process.


Hi @AbarnaKalaiselvam
You are using work book activities then no need to give Excel application scope
Regards,

yeah that right actually its running fine but in the middle its stops and through an error.
Is there any problem with 2 write cell inside the for each loop?
when i’m using one write cell inside the loop its running fine.

Just for the sake of testing, can you try adding a small delay in between the 2 write cell activities? This will allow checking whether the issue is due to the fact that the two activities are somehow in conflict with each other. This is not a solution, it’s just to troubleshoot the problem.

I’m trying out that delay activity…its working but delay of 2 seconds in working…

Instead of writing each cell for each row, can you try a different approach?
For example:

  • Read the range of data as a datatable (same as you’re already doing)
  • Do a For Each loop on each DataRow of the DataTable (same as you’re doing)
  • Update the value of the cell in the DataTable on each DataRow (instead of using Write Cell)
  • **Write the DataTable back into the Excel file as a Write Range activity

So you’ll only write into the Excel file once (at the end of the loop) instead of doing it for each row.

Would this work?

Can you explain in detail?
“=IF(ABS(F” + cellIndex.ToString + “)>=1500, ““Yes””, ““No””)”
“=E”+cellIndex.ToString+“*1.32”
want to write this in cell F and G
how to update in datatable?

If that’s your need, why don’t you use the Fill Range activity instead?
Activities - Fill Range (uipath.com)
It seems to match exactly your needs, and you won’t have to use a loop. You’ll have to use 2 “Fill Range” activities (one for the 1st formula, the other for the 2nd formula).

Actually I don’t want to open the excel and do the automation.
without using Excel Application scope
I’m done using the Excel Application scope is working fine

@AbarnaKalaiselvam

If you use multiple workbook activities in row….then this might be the issue…

one you can try using kill process after each…

Or you can use delay

Or use one excel application scope and do all the activities inside them…so that the excel is not opened multiple times and you can set application scope to not visible as well

Cheers

@Anil_G thankyou so much

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.