# Unable to read data from Excel file variable not found

**URL:** <https://forum.robotframework.org/t/unable-to-read-data-from-excel-file-variable-not-found/6595>\
**Category:** Robot Framework\
**Created:** [28 December 2023 03:16 UTC](https://forum.robotframework.org/t/unable-to-read-data-from-excel-file-variable-not-found/6595 "2023-12-28T03:16:47Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Russel82](https://avatars.discourse-cdn.com/v4/letter/r/90db22/32.png) [@Russel82](https://forum.robotframework.org/u/Russel82)\
**Post date:** [28 December 2023 03:16 UTC](https://forum.robotframework.org/t/unable-to-read-data-from-excel-file-variable-not-found/6595/1 "2023-12-28T03:16:47Z")

</div>

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 ?

---

<div class="post-metadata">

**Author:** ![Pramesh](https://avatars.discourse-cdn.com/v4/letter/p/848f3c/32.png) [@Pramesh](https://forum.robotframework.org/u/Pramesh)\
**Post date:** [28 December 2023 09:15 UTC](https://forum.robotframework.org/t/unable-to-read-data-from-excel-file-variable-not-found/6595/2 "2023-12-28T09:15:19Z")

</div>

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](https://github.com/Snooz82/robotframework-datadriver#example-test-suite) . 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.

---

<div class="post-metadata">

**Author:** ![orenault](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/orenault/32/3267_2.png) [@orenault](https://forum.robotframework.org/u/orenault)\
**Post date:** [28 December 2023 09:47 UTC](https://forum.robotframework.org/t/unable-to-read-data-from-excel-file-variable-not-found/6595/3 "2023-12-28T09:47:32Z")

</div>

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]`

---

<div class="post-metadata">

**Author:** ![Russel82](https://avatars.discourse-cdn.com/v4/letter/r/90db22/32.png) [@Russel82](https://forum.robotframework.org/u/Russel82)\
**Post date:** [28 December 2023 13:21 UTC](https://forum.robotframework.org/t/unable-to-read-data-from-excel-file-variable-not-found/6595/4 "2023-12-28T13:21:42Z")

</div>

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}

---

<div class="post-metadata">

**Author:** ![Russel82](https://avatars.discourse-cdn.com/v4/letter/r/90db22/32.png) [@Russel82](https://forum.robotframework.org/u/Russel82)\
**Post date:** [28 December 2023 20:02 UTC](https://forum.robotframework.org/t/unable-to-read-data-from-excel-file-variable-not-found/6595/5 "2023-12-28T20:02:20Z")

</div>

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’]
