How to download a file and overwrite an existing excel file

Hi Allan,

I have a use case that involves downloading an excel file from a website, after the download this new file should overwrite an existing file in some folder.

I get stuck after clicking the download link. How do I proceed to use the new file/data to overwrite the old file?

Currently my final step is this:

Hope you can help


Since you download the file using a link, and not using some kind of activity in OpenRPA, you just need to come up with a replacement algorithm.

For example:

  1. The old file is marked with the postfix “_old” or “_forDelete”
  2. Download the file
  3. Delete the file with postfix

The algorithm should be adjusted if there are any special requirements for the RPA process (file name, speed, etc.)

Thanks for your reply, but unfortunately this is not exactly what I’m looking for. I’ll try to explain a little bit more in detail what I need:

I have an excel file with a specific name in a specific folder (No postfix)
Every day, I want to replace this file (or overwrite the data in this file) with the new file/data I get from the download.
The file I download does not have the correct name yet and is not automatically downloaded to the correct folder.

So for example, the file I would like to replace looks like this:
Filename: “MyFile.xlsx”
Folder: “\something\something\Desktop”

The downloaded file is like this:
Filename: “NotMyFile.xlsx”
Folder: “\something\something\Downloads”

In the end “NotMyFile.xlsx” should become “MyFile.xlsx” in folder “\something\something\Desktop”

Hopefully this clarifies the use case better.

In this case, I would simply take the data from “NotMyFile.xlsx” and put them in “MyFile.xlsx” and then delete the first file

I understand that something like that is what needs to be done, only not how to achieve this. This is probably easy but I’m quite new to OpenRPA.

So, what I would like to know is:
How to retrieve the data from the downloaded file?
How to put it in the correct file?
How to delete a file?

Hope you can help!

There is a feature built into the chrome extension for this exact case
Add “Wait for download” activity, and INSIDE that, do the click that triggers a download.
then AFTER the “Wait for download” use the event from “Wait for download” to get the filename of the downloaded file.

This will not overwrite the old file, but it WILL give you the current/new name.

1 Like

Thank you very much for your reply, I think I figured it out!

One more question, I’m now using ReadExcel and WriteExcel to extract the data from the downloaded file and update the correct file. The problem is that the downloaded file has a worksheet name starting with numbers, for example “1 sheet”. Which results in this error:

The table name ‘1 sheet’ does not begin with a letter, an underscore or a backslash.

Is there a way to change the name of the Worksheet or another workaround?

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