# Refresh internal excel data

**URL:** <https://forum.katalon.com/t/refresh-internal-excel-data/26178>\
**Category:** Web Testing\
**Tags:** katalon-studio\
**Created:** [May 24, 2019, 11:58am UTC](https://forum.katalon.com/t/refresh-internal-excel-data/26178 "2019-05-24T11:58:16Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![morgan.jenkins](https://avatars.discourse-cdn.com/v4/letter/m/0ea827/32.png) [@morgan.jenkins](https://forum.katalon.com/u/morgan.jenkins)\
**Post date:** [May 24, 2019, 11:58am UTC](https://forum.katalon.com/t/refresh-internal-excel-data/26178/1 "2019-05-24T11:58:16Z")

</div>

Hi Guys,

So I have a testcase where I write data to an excel file using a custom keyword, this works fine the file is updated. However, in the next testcase I need to retrieve this data again to verify. My issue is that in this test case I am binding the data file to variables but the data being used is the data before the excel file was updated. Which makes me believe that Katalon does not refresh the data from the excel file that is being used during execution. My question is is there a way for me to refresh the data file? Or is my only solution to create another custom keyword to retrieve the data directly from the excel file?

---

<div class="post-metadata">

**Author:** ![Brandon\_Hein](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/brandon_hein/32/1092_2.png) [@Brandon\_Hein](https://forum.katalon.com/u/Brandon_Hein)\
**Post date:** [May 24, 2019, 3:14pm UTC](https://forum.katalon.com/t/refresh-internal-excel-data/26178/2 "2019-05-24T15:14:11Z")

</div>

Can you share your test code?

---

<div class="post-metadata">

**Author:** ![Arnel](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/arnel/32/6360_2.png) [@Arnel](https://forum.katalon.com/u/Arnel)\
**Post date:** [May 27, 2019, 6:43am UTC](https://forum.katalon.com/t/refresh-internal-excel-data/26178/3 "2019-05-27T06:43:11Z")

</div>

Hi Morgan,

I think you need to call your excel file again. Because by default katalon only reads the loaded test data upon execution and it will be the same data even if you did a change on your test data while executing the test. It’s like you need to restart the test to acquire the updated values.

Now, to get the updated values you need to access the excel directly or programmatically.

try calling it using this. . . I think this will do the trick…

```auto
import com.kms.katalon.core.testdata.reader.ExcelFactory

//create an instance
Object excel = ExcelFactory.getExcelDataWithDefaultSheet("yourExcelPath.xlsx", "SheetName", true)

//pass your test case variables
excel.getValue("tc_variable", 1)

/**
Where 1st param is string column name and 2nd param integer is row number.

theres an overload to that method where the first param is integer.
**/

```

Or if you don’t have many sheets or you only have default sheet in your test data, try this other approach. . .

```auto
import com.kms.katalon.core.testdata.ExcelData

ExcelData excelData = new ExcelData("yourExcelPath.xlsx", true)
excelData.getValue("tc_variable", 0)

//same param definition as mentioned above.

```

Hope that helps. . . 🙂

---

<div class="post-metadata">

**Author:** ![neamehbaydoun66](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/neamehbaydoun66/32/20065_2.png) [@neamehbaydoun66](https://forum.katalon.com/u/neamehbaydoun66)\
**Post date:** [June 29, 2022, 12:30pm UTC](https://forum.katalon.com/t/refresh-internal-excel-data/26178/4 "2022-06-29T12:30:46Z")

</div>

man exceldata is an abstract class,i am not able to create an instance of this class as

```auto
ExcelData myData = new ExcelData("C:....\\Data Files\tester1.dat",true)

```

is there any class that helps me define programmatically excel data file and change sheet when needed

---

<div class="post-metadata">

**Author:** ![Arnel](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/arnel/32/6360_2.png) [@Arnel](https://forum.katalon.com/u/Arnel)\
**Post date:** [June 29, 2022, 7:56pm UTC](https://forum.katalon.com/t/refresh-internal-excel-data/26178/5 "2022-06-29T19:56:56Z")

</div>

Hello [neamehbaydoun66](http://forum.katalon.com/u/neamehbaydoun66),

You can try this

```auto
import com.kms.katalon.core.testdata.reader.ExcelFactory

//create an instance
ExcelData excel = ExcelFactory.getExcelDataWithDefaultSheet("yourExcelPath.xlsx", "SheetName", true)

//pass your test case variables
excel.getValue("tc_variable", 1)

```

Where  
-First parameter will be the excel path  
-Second parameter will be the sheet name. You can change sheet name on run time just put a string variable  
-Third, make it true if you want to make the first row as headers or false if you want to make the first row as plain record

Hope that helps. . . 😃

---

<div class="post-metadata">

**Author:** ![neamehbaydoun66](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/neamehbaydoun66/32/20065_2.png) [@neamehbaydoun66](https://forum.katalon.com/u/neamehbaydoun66)\
**Post date:** [June 30, 2022, 6:34am UTC](https://forum.katalon.com/t/refresh-internal-excel-data/26178/6 "2022-06-30T06:34:24Z")

</div>

That’s running fine thanks for the help 🫂

---

<div class="post-metadata">

**Author:** ![Arnel](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/arnel/32/6360_2.png) [@Arnel](https://forum.katalon.com/u/Arnel)\
**Post date:** [June 30, 2022, 6:51pm UTC](https://forum.katalon.com/t/refresh-internal-excel-data/26178/7 "2022-06-30T18:51:55Z")

</div>

Sure, you’re welcome. Glad I helped.

Cheers! 🍻

---

<div class="post-metadata">

**Author:** ![sara.leslie](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/sara.leslie/32/20699_2.png) [@sara.leslie](https://forum.katalon.com/u/sara.leslie)\
**Post date:** [August 4, 2022, 5:43pm UTC](https://forum.katalon.com/t/refresh-internal-excel-data/26178/8 "2022-08-04T17:43:21Z")

</div>

Closed on August 4, 2022, 5:43pm UTC


