Unable to read data from Excel file variable not found

Hi folks,

I’m working on to create a script with 100 some parts and check their certain attribute by clicking on certain tabs. So I thought to get the parts list from a XLSX file but I’m keep getting error variable ${username} not found. ${username} is the Excel sheet first column I’m using just to test this method for my application login. I did add data driver package and ran pip install robotframework-excellib . I did proper spacing. Spending whole day but still couldn’t make this to work. My excel file placed inside Testdata folder and sheet name is Data.xlsx. So I passed the path as below:
Library DataDriver …/Testdata/Data.xlsx . Spent whole lotta tine on this to figure this out but still no success.
Any suggestion please ?

Hi @Russel82 ,

Would it be possible to share your code or at least the part of it, so that it will be easy to see where the issue is?

For example, here is the example test suite from the Github page: GitHub - Snooz82/robotframework-datadriver: Library to provide Data-Driven testing with CSV tables to Robot Framework . I guess the first step is to check if your test suite and data file structure match with the expected structure.
As I said before, would be easy to debug if you could share your code/configuration.

If you uxe XLSX file with datadriver-library, you have to install the Excel support:

Excel Support

For file support of xls or xlsx file you need to install the extra XLS or the dependencies. It contains the dependencies of pandas, numpy and xlrd. Just add [XLS] to your installation. New since version 3.6.

pip install --upgrade robotframework-datadriver[XLS]

Thank you much for the replies guys. Plz find my code, below. I did run
pip install --upgrade robotframework-datadriver[XLS] and ‘pip install -U robotframework-datadriver[XLS]’ as per the below error
[ ERROR ] Calling method ‘_start_suite’ of listener ‘DataDriver’ failed: ImportError: Requirements (pandas, openpyxl) for XLSX support are not insta
lled.
Use ‘pip install -U robotframework-datadriver[XLS]’ to install XLSX support.

My Exact location of this Excel is : C:\Users\33434555\PycharmProjects\View\Data

*** Settings ***
Library SeleniumLibrary
Resource …/view/resources.robot
Resource variables/CommonVariables.robot
Resource …/View/test.robot
Library DataDriver …/Data/Data.xlsx

Suite Setup Application Loggin
Suite Teardown Close Browsers
Test Template Login

*** Test Cases ***

WhenLoginusing ${username} ${Pwd}

[Tags] View home Page Verification

*** Keywords ***

Login
[Arguments] ${username} ${Pwd}
Enter Username ${username}
Enter PWD ${Pwd}

Update on this issue :
Now I’m able to read my test excel file ${user} and ${Pwd} but not able to run more test cases with part no reading from same Excel file after I logged in. Scenario is once I login I will enter different parts # then click on few tabs to verify few features then enter another part # and click on few tabls availble under that part # and verify. My set up and code is below . Now It’s just running the 1st test case for Login.

Suite Setup Application Loggin
Suite Teardown Close Browsers
Test Template InvalidLogin
Test Template eVerify Part #2642M72G03

*** Test Cases ***

LoginwithExcel using ${username} ${Pwd}

[Tags] ViewIT home Page Verification

Enter Username ${username} And ${Pwd}

Verify Part #2642M72G03 ${Part}
eVerify Part #2642M72G03

*** Keywords ***

InvalidLogin
[Arguments] ${username} ${Pwd}
Enter Username ${username}
Enter PWD ${Pwd}

eVerify Part #2642M72G03

Application Loggin

[Arguments] ${Part}
Input Text //[@id=“app”]/div/main/div[1]/div[1]/div/input ${Part}
Sleep 2
Click Element //
[@id=“app”]/div/main/div[1]/div[1]/div[2]/div/div[1]/div/div[2]/div/div/div/div/div[1]/label/b[1]/span/span/span
sleep 3
Press Keys //b[contains(text(),‘TDP/Drawing Graphics Sheets –’)] Enter
sleep 2
Click Element //label[@for=‘h3V9vv55pgUOLA’]
Wait Until Element Is Enabled //input[@value=‘Download Selected’]