Excel Write Range Activity Fails for no reason

Hello there, hope you all are doing fine!

I’ve had some trouble trying to write data to an excel file. I’ll try to explain as best as possible.
I designed a workflow that writes data to an excel. For what I know, when using a Excel Application Scope, if the name does not exist, a new one is created. Then we go into a try-catch block. If the sheetname exists in the excel file, then it appends the data from a DataTable Variable. I did this because I use diferent workflows that save data to the same file, so with append range, column names will not be witten again.
Then we have the catch, when the activity cannot find the sheetname. This means that the data to be witten is the first so a new sheet must be created and headers must be added. This should not trigger any error (by the catch section).

And so far, I have used this activity for some small data (like 25 columns by 150 rows), but then I tried something bigger (25 columns by 2000 rows) and then it just doesnt work, it fails in the writeRange Activity with the next exception:

image
image

And that’s all the info I got, I suspect that maybe because my RAM size is not enough (8 GB), but it should work. I tried debug mode but it just ends the program. I don’t know what should I do. Any suggestion is welcome.

Thanks in advance!

Hi,

I think you had good work flow with the logic to create sheet dynamically in the Excel. Can we try adding “”(double quotes for to take whole sheet as range) in the write range activity and try running the work flow and let us know. Thanks.

It’s much better to code logic to check if the file exists, and create it if it doesn’t exist. Try/Catch for this is messy.

Also, the Excel Application Scope should be inside the Try/Catch not the other way around.

Yes I did that, added the double quotes and the result is the same.
Actually I excecuted the same workflow, but with only 48 rows and it worked fine, so I imagine that is not about my wf in general, it’s about my pc. :frowning:

Reading the documentation of Excel Application Scope and WriteRange Activity, it says that if the file does not exist, then a new one is created. Same for the WriteRange, if the sheet does not exist, a new one is created. So I used this to create automatically my file and sheet. Idk how to “create” manually. But this is not resolving anything, data is not written yet…

After all this time, I found my own solution and that is by saving data rows by 500 rows per saving in excel instead of saving 2000 rows at once and it just works fine again. Thank you for the supp!

1 Like

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