I am not sure what the code you have there do as it is incomplete.
So assuming that you want to do data driven testing, use RobotFramework-datadriver: Structure of data file.
Installation:
pip install --upgrade robotframework-datadriver
pip install --upgrade robotframework-datadriver[XLS]
Create the excell sheet 1.xlsx and keep it in the same directory as .robot file

Now use below robot file:
*** Settings ***
Documentation This is the script for Create Sales Visit Repository
Library SeleniumLibrary
Library DataDriver file=1.xlsx sheet_name=Sheet1
Test Template Run Data Driven Steps
*** Test Case ***
Test Case 1 :Test behavior for Login temp temp
*** Keywords ***
Run Data Driven Steps
[Arguments] ${name} ${age}
Log ${name}
Log ${age}
Explanation:
Robotframework uses Test Template for data driven testing , datadriver leverages this to drive the test using data from excel or csv than hard coding it in test step.
Library DataDriver file=1.xlsx sheet_name=Sheet1
initialise the data drver with the xlsx file in which we have the data.
Test Template Run Data Driven Steps
tells robot that the testcase in suite uses the keyword 'Run Data Driven Steps' as the template. So we defines the test step inside this keyword and not the actual Test Case.
eg:
*** Keywords ***
Run Data Driven Steps
[Arguments] ${name} ${age}
Open ${url}
Login using ${1}
Validate a==b
Now in test case , we call a dummy test case just to trigger the test. The argument is also dummy. But as we say the template Run Data Driven Steps
excepts two arguments we have to specify two dummy arguments to test case Any test name temp temp
Output:
Note: i used test name as
Test Case 1 :Test behavior for Login using ${name} and password ${age}
Thats why the data is being printed in the test name
