I have a system that generate Excel reports based on a filled form.
How do I capture the file response so that I can continue working on the file.
“Download” takes an Url.
I have a system that generate Excel reports based on a filled form.
How do I capture the file response so that I can continue working on the file.
“Download” takes an Url.
Hello @morten,
could give a bit more detail about your case and how your application works?
Is this all happening via an API, where you POST the form data and you get the file back as part of the response? is there a UI involved?
It’s a web application for time registration.
I’m navigating the application using RPA.Browser. I’ve successfully logged in and can get to the reporting view. Here I can setup a range of parameters eg. date span as well. Next step is to download the report in Excel so that I can work with it from here. To do that I can tricker the JavaScript “__doPostBack(‘btnSaveSearchView’,’’)” but that will not equal a download request and the file will not be available to further work on.
hi @morten !
I tried to simulate your situation like this:
Open Chrome Browser
(this particular solution works in Chrome only)Wait Until Keyword Succeeds
and File Should Exist
RPA.Excel.Files
library and read its contents.(To simplify the code, I am using the folder where the robot is running from, you will need to set the appropriate paths, probably)
Here’s the code:
*** Settings ***
Library RPA.Browser
Library RPA.Excel.Files
Library OperatingSystem
*** Variables ***
${FILENAME}= file_example_XLS_10.xls
${DIRECTORY}= ${CURDIR}
*** Tasks ***
Download xls file via browser and process it
${prefs}= Create Dictionary download.default_directory=${DIRECTORY}
Open Chrome Browser https://file-examples.com/index.php/sample-documents-download/sample-xls-download/ preferences=${prefs}
Click link css:.download-button
Wait Until Keyword Succeeds 2 min 5 sec File Should Exist file_example_XLS_10.xls
Open Workbook file_example_XLS_10.xls
${table}= Read Worksheet As Table header=True
Close Workbook
FOR ${row} IN @{table}
Log ${row}
END
[Teardown] Close All Browsers
Here’s how it looks like in Robocode Lab:
I hope this helps!