Check if Excel file is fully loaded

Hello,

I try to download a huge Report as a Spreadsheet (Excel file “.xlsx”) from SAP which is about 30MB big. The problem I am facing, in the end the file should be uploaded to the Sharepoint, which is not directly possible within SAP.

Here are my steps after I triggered the download

  • Check which GUI appears for the upcoming download
  • Fillout the path and filename
  • Generate the Excel file
  • After the Download, the Excel file opens automatically

To time the next step, which is about to kill all open Excel files (otherwise it could be in use when I try to upload it to Sharepoint)

  • Check if the Excel file is fully loaded to perform the kill

I was facing some problems when I just tried with a simple delay. Sometimes no Excel file was found and sometimes it was killed. And I dont want to block the bots longer than needed, beacuse i know a simple delay of 30min would hellp.

What Activities I tried so far:

  • Element exists within a Do while Loop → Tried to check the Header name of the file
  • Element exists with a Retry Scope → Tried to check the Header name of the file
  • Check App state → Tried to check the Header name of the file
  • Check App State → Check Range A1

Do you have any ideas how to make it 100% trust worthy?

Thank you in advance, René

Instead of relying on checking headers or UI states, use file properties to ensure the file download is complete.

Example - wait for download activity in UiPath

Or if you know the path of the file - Use Path Exist activity

@sharazkm32 thank you for your reply.

So the Path Exists activity just gives an output when the file is fully loaded? So in combination with Retry Scope or do while this should fix my problem?

I’ll test ist tomorrow and give feedback.

Thanks for now!

So I tried both suggested Activities, but they didn’t work out.

The wait for download activity had 2 problems:

  • I have a longer if statement after I use the Download trigger
  • This results in an Denied Error from SAP

The Path Exists Activity inside a do while showed the same problem as before, that the file wasn’t fully loaded and the kill process didnt’ recognize any open Excel files.

This was put inside the Do Loop from the wait for download activity

![image|690x469](upload://6SDEaeYnIj2xFhEQ7AbO38SZZ9G.png

@DonPromillo

Not sure what you have done in wait for downalod…it shpuld be working if the file already does not exist

Now another work around is in excel left bottom ypu would see done or ready once the excel is completely downloaded and ready to be used…may be you can try indicating the same in check app state

Cheers

Hi @DonPromillo

I would suggest you explore wait for download activity more.

Kindly confirm following

  1. Activities for downloading the file should be placed inside the DO activity
  2. Confirm the monitored folder is correct. By default - it is monitoring download folder
  3. Check any temp files are created during the download time - identify the extension and include in the field - Ignore these temporary file extensions
  4. Output file variable to be placed in the field Downloaded File

Also make sure that in the properties - Timeout is set based on your requirement. By default - it is 300 seconds

Also share a code snippet for us to refer. Specific to wait for download

I’m sorry for the confusing posts. Wasn’t allowed to post more than 1 Screenshot and rearranged it…

So here’s my current process without the changes and you can see I have to check a bunch of things to get the Excel downloaded.

What I did, I put the whole part from the download execution, until the kill process inside the wait for Download activity:

And heres the exact file location where it is saved (var: strDesktopfile)

@Anil_G

I also tried it with the ready status in the Excel file with the “Element exists” activity. Didn’ work out either.

@DonPromillo

can you please show some screen shots…not working will not help understand the cause nor help inn resolving

cheers

So right now this was my Check before I tried Wait for Download or Path Exists:

Which generated the ddesired output, but had some warnings (Sorry but I am just allowed to post one image at a time…):

message:
Target ‘‘Cost element’’ was found using fallback method ‘Computer Vision’.
level: Warning

message:
Anchor 1 ‘‘Val.in rep.cur.’’ was found using fallback method ‘Computer Vision’.
level: Warning

message:
[Target ‘‘Cost element’’]: Could not find the UI element corresponding to this selector:
[1]
[2]

Search failed at selector tag:
[1]

The closest matches found are:
[33%]
[25%]
[24%]
[24%]
[24%]
[23%]
[22%]
[22%]
[22%]
[22%]
level: Warning

So I was searching for another method…

So I tried already tried the Status of the Excel File → “Ready”
With these Selector Options

And thats what I did with the Wait for Download Activity:

  1. In the monitored Folder I just put my Desktop (thats the location where SAP Should save it) → Didnt recognize it, so the Kill Process didnt find anyopen Excel files and the upcoming error was during saving the file on the Sharepoint, cause the Excel file was in use… Yes it was open :confused:

  2. I put the Path and File into the Var which also ended in an error from SAP: Access denied sy-subrc: 15 → but that’s beacuse he’s then creating the folder on the Desktop named xxx.xlsx

Not sure whether you git the solution or not

I would suggest to keep only the step specific to download in the wait for download activity instead of keeping everything