Download keyword, Read csv file and change directory

Hi, im new in Robocorp.
I have few question and wonder how to done it.

  1. how to use keyword “Download”
  • I have try it, follow the example in documentation but its not working. I not sure how you copy the link (currently I using “Click Button” to download the document - the document will place into my download directory)
  1. how to change the directory instead using default directory.
  • since the downloaded document place inside download directory so I need to change the directory for Robocorp to read the file.
  1. how to read csv file
  • the downloaded file format as csv.

Thank You

Hi, @mqayyum1223!

For changing the browser default download directory, see this robot for inspiration:

*** Settings ***
Documentation     Download a file to a custom browser download directory.
Library           RPA.Browser
Library           OperatingSystem

*** Variables ***
${FILENAME}=      file_example_XLS_10.xls
${DOWNLOAD_DIR}=    ${CURDIR}

*** Keywords ***
Wait For Download To Complete
    Wait Until Keyword Succeeds
    ...    2 min
    ...    5 sec
    ...    File Should Exist
    ...    ${FILENAME}

*** Tasks ***
Download a file to a custom browser download directory
    &{preferences}=
    ...    Create Dictionary
    ...    download.default_directory=${DOWNLOAD_DIR}
    Open Chrome Browser
    ...    https://file-examples.com/index.php/sample-documents-download/sample-xls-download/
    ...    preferences=${preferences}
    Click Link    css:.download-button
    Wait For Download To Complete
    [Teardown]    Close All Browsers

For reading the csv file, see if the Read Table From Csv from the RPA.Tables library would help:

// Jani

Hi Jani,
Thank You for your response.
However, can you provide example how to use the library to read Table from csv.
the documentation does not provide any example how to use it.

for this part,
*** Variables ***
{FILENAME}= file_example_XLS_10.xls {DOWNLOAD_DIR}= ${paste download directory here} I have try this way but seem not working…

Thank You

Here’s an example of reading a csv file (using a sample csv file from here: https://data.europa.eu/euodp/en/data/dataset/final-budget-2016/resource/de08060d-de77-462b-8b71-b3f4cb44b8b8):

*** Settings ***
Documentation     Read a csv file into Tables.
Library           RPA.Tables

*** Tasks ***
Read a csv file into Tables
    ${tables}=
    ...    Read Table From Csv
    ...    ${CURDIR}${/}c!SEC1_E!en!0.csv
    ...    header=True
    Log    ${tables}

Table object from the log after reading the csv file:

 	Table(columns=['Level', 'Alias', 'Budget Line', 'Type', '2016 Commitment', '2016 Payment', '2016 CATPOL', '2016 Reserves Commitment', '2016 Reserves Payment', '2016 Reserves Destination', '2015 Commitment', '2015 Payment', '2015 CATPOL', '2015 Reserves Commitment', '2015 Reserves Payment', '2015 Reserves Destination', '2014 Commitment', '2014 Payment', '2014 CATPOL', '2014 Reserves Commitment', '2014 Reserves Payment', '2014 Reserves Destination', 'RAL'], rows=131)

I have try this way but seem not working…

What did the log say? It usually contains some hints on what went wrong.