Hi, as per the title of this post. May I know how to properly stop script if condition return false. Say Run Keyword Unless…
Hi, @chiu.leonard!
The Pass Execution If keyword (built-in, no need to import libraries) might be useful in that scenario.
// Jani
Thanks @jani Appreciate the help. May i ask another q? I want to copy the value of a cell in excel and assign to a variable then check if it is empty. How do i do that? Seem so simple in other language that i am used to…
Press Keys. cmd. c
{isEmpty}= Get Clipboard Value
Run Keyword If {isEmpty} == ’ " " ’ “some keyword”
Hi, @chiu.leonard! All questions are welcome!
If you want to read values from an Excel file, you don’t have to open the Excel application at all. You can read the file directly. This is faster and also works on systems that do not have Excel installed.
Here’s an example where we:
- Open a workbook
- Read it as a table (a generic table structure)
- Read a specific cell in that table
- Check if the value in that is empty or not
*** Settings ***
Library RPA.Excel.Files
Library RPA.Tables
*** Tasks ***
Check if a specific cell is empty in an Excel file
Open Workbook SalesData.xlsx
${table}= Read Worksheet As Table
Close Workbook
${value}= Get Table Cell ${table} row=${1} column=${1}
Run Keyword If "${value}" == "${EMPTY}" Log To Console Empty!
Run Keyword If "${value}" != "${EMPTY}" Log To Console Not empty!
Does this answer your question?
- RPA.Excel.Files
- RPA.Tables
- Working with Excel
- Downloading and reading an Excel file
- Robot Framework variables
// Jani