HELP - How to loop files using get folder content and Open spreadsheet cmd

for-each
get-folder-content

#1

Hi Everyone,

I hope you can help me looping a list of files which I need to open i Excel open spreadsheet function.

Here is what I do:
get folder content (saved into a list)
For each (item) in (myList)
Open spreadsheet ( ${myList)} )

I test the content of ${myList)} by writing each char to a file like this: ${myList[index])} however
there is garbage in the end of the file ( like this ooooo) so the Open spreadsheet command does not work.

How to remove this garbage from my list values or to execute this in a better way.

PS I use RPA Express 1.1.9

I hope you can help!


#2

This morning I tried to change the file from .xlsx to the old Excel version xls. However, the problem is the same. The last to char in the file extension is not readable.

I tested this by writing the char to a file and I get an exception every time I get two the lat to char.

I’m a newbi, please help me get around this issue.

Thanks.


#3

Hi Michael,
You should use ${item} as the path to the file inside the loop.
If this doesn’t work please share your zipped recording here, we’ll have a look.

Alesia


#4

Hi Ashapkina,

You are right just misunderstood the which variable that I needed to use. However it does not work with I use the old version of Excel (xls). I can load the files but the operations does not work … not the same result as for xlsx files.

Luckily I want to use xlsx so it looks like everything is working, otherwise I will update this thread in the morning.

Thank you very much :slight_smile:


#5

Glad to know it helped :slightly_smiling_face:
However, you should be able to open .xls files like this, as well. At what step does the error occur, when writing the value to the excel file?


#6

Hi @mc1
I seem to have the same problem as you with the “garbage” in the filename when using the “get folder content” action.
The correct filename in my example is:
“…\9 0B78427531_0111 28217351328_RNT_JUNIO DE 2017_10.pdf” but the get folder content function returns this:
…\9 0B78427531_0111 28217351328_RNT_JUNIO DE 2017_10.pdf
The complete path up to the filename is read correctly. Only the filename is messed up.
I tried removing the “garbage” with the replace text action but that function doesnt do it.

How did you clean up the filename?


#7

Tim, does the filename work if you use it as a path to the file or when you copy it to a text file, for example?

It seems that the value is stored correctly, but there is a bug in the way some characters are displayed in the execution-result.log file, similar to the issue with some language-specific characters: International characters handling.
We will investigate it.


#8

Hi Alesia

it works correctly when I delete the first part of the filename like this:
RNT_JUNIO DE 2017_10.pdf
it does not work with this filename:
9 0B78427531_0111 28217351328_RNT_JUNIO DE 2017_10.pdf

Strangely RPAx doesnt like the first part of the filename.


#9

Hi Ashapkina,

It was just a simpel test but It does not work for the old Excel files - but I currently don’t need that. I guess I was just wondering if there was a reason.

Best regards,
Michael


#10

Michael, could you please share your recording so we can have a look.
This is supposed to work with .xls files, as well.


#11

Hi Ashapkina,

I tried to reproduce the error in a new recording but that is not possible, so the error must be me :wink:

Best regards,
Michael