Hi i currently run into a problem with the Read Range activity.
Expected Behavior:
I Select a file and Sheet and it returns a datatable for that sheets data without changing the original file.
Actual Behavior:
- It opens a new Excel File.
- It creates the Configured Sheet in that new Excel File.
- It overrides the Original file.
Is something broken for me or is that a bug?
Greetings Marvin
After testing some more we found out this behavior only happens when using a relative path.
When using a full path it works as expected.
If you leave Worksheet
empty, it will use the default/last used sheet.
If you give it a sheet name that exits, it will change active sheet to that sheet.
If no sheet with that name exists it will create one and make that the active sheet.
Read range does not save the file at any point.
Read range has not been tested with relative paths ( why would you do that anyway ? you cannot assume openrpa is always installed to the same base folder )
Filename
supports environment variables like %USERPROFILE% to make sure it will work with different users
Hi Allan,
Thank you for your fast response. It’s good to know how it behaves with no sheet name and the suggestion with the USERPROFILE thats exctly how we will solve it. Let me address the other points so:
Read range does not save the file at any point.
I understand, that this is not wanted behavior and a bug, but i can assure you that ReadRange DOES save the file if you call it with a relative path like /Data/MyXaml.xaml
Also for some reason it does not take the OpenRPA Folder as its base in this case but instead uses C://User/CURRENTUSER/Documents as its base path. Maybe something you want to look into? There was nothing else in my workflow that could have done it. I literally tested it with an empty workflow that only contained a ReadRange.
why would you do that anyway ?
Because its expected behavior for nearly all programming languages and tools. Yes i can solve it easily with the full path and i don’t really mind, but the question why you would do it is odd to me since so many tools out there let you do this.
Anyways thanks for your help and you might want to check my bug report because it might lead to overriding some important files for someone accidently using a relative path.
Greetings Marvin
“why would you do that anyway ?” sounded a bit rude, sorry that was not the intention. But a genuine question, and thank you for answering it.
You are absolutely correct, that is a common thing to do, I think what “threw me off” was that most people use the file selector button, that does this automatically hence, in 7 years, noone has ever asked that question before, and there it has never been tested.
Anyway, back to the issue. I think i know what the problem is, and it’s in OpenRPA’s code, they way it finds the correct instance of a excel to work with, is by matching on filename (full path and filename) since you can have multiple version of the same file open.
( read/write range share a lot of code, and some of that code also handles creating a new file if one does not exists, and that requires calling save on the workbook )
I’ll move this post to the “issues” topic, so i remember having a look at this, the next time I’m working on the OpenRPA code base.