# Test data - excel binding, can we get the row number or iteration id at runtime

**URL:** <https://forum.katalon.com/t/test-data-excel-binding-can-we-get-the-row-number-or-iteration-id-at-runtime/14456>\
**Category:** Integrations\
**Tags:** integrations, katalon-studio\
**Created:** [November 27, 2018, 10:26pm UTC](https://forum.katalon.com/t/test-data-excel-binding-can-we-get-the-row-number-or-iteration-id-at-runtime/14456 "2018-11-27T22:26:59Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![Manjula\_Siddanna](https://avatars.discourse-cdn.com/v4/letter/m/97f17d/32.png) [@Manjula\_Siddanna](https://forum.katalon.com/u/Manjula_Siddanna)\
**Post date:** [November 27, 2018, 10:26pm UTC](https://forum.katalon.com/t/test-data-excel-binding-can-we-get-the-row-number-or-iteration-id-at-runtime/14456/1 "2018-11-27T22:26:59Z")

</div>

Hi,  
I am trying to input data using excel and it works fine. Now, I want to output data, and at runtime I don’t know how to get the row number or the iteration that it is executing on.

Is there a way to get the row or the iteration that it is working on.

Thanks,  
MS

---

<div class="post-metadata">

**Author:** ![Ibus](https://avatars.discourse-cdn.com/v4/letter/i/e9a140/32.png) [@Ibus](https://forum.katalon.com/u/Ibus)\
**Post date:** [November 28, 2018, 6:28am UTC](https://forum.katalon.com/t/test-data-excel-binding-can-we-get-the-row-number-or-iteration-id-at-runtime/14456/2 "2018-11-28T06:28:42Z")

</div>

I suppose you mapped the excel data to the test case in a test suite, through some variables defined in the test case.

So just output the value of the variables.

---

<div class="post-metadata">

**Author:** ![Anup\_Nair1](https://avatars.discourse-cdn.com/v4/letter/a/94ad74/32.png) [@Anup\_Nair1](https://forum.katalon.com/u/Anup_Nair1)\
**Post date:** [March 6, 2019, 10:57am UTC](https://forum.katalon.com/t/test-data-excel-binding-can-we-get-the-row-number-or-iteration-id-at-runtime/14456/3 "2019-03-06T10:57:06Z")

</div>

Hi,

I am looking for answer to the same question. Does Katalon Store the current row number that it is executing during data binding?  
If yes, how can we get the value of the current row number ?

---

<div class="post-metadata">

**Author:** ![huynguyen](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/huynguyen/32/552_2.png) [@huynguyen](https://forum.katalon.com/u/huynguyen)\
**Post date:** [March 6, 2019, 4:55pm UTC](https://forum.katalon.com/t/test-data-excel-binding-can-we-get-the-row-number-or-iteration-id-at-runtime/14456/4 "2019-03-06T16:55:37Z")

</div>

@Manjula_Siddanna, you can get the row or the iteration that is being worked on. Please refer to this guide [https://docs.katalon.com/katalon-studio/tutorials/data\_driven\_testing.html#what-is-data-driven-testing](https://docs.katalon.com/katalon-studio/tutorials/data_driven_testing.html#what-is-data-driven-testing) for more details.  
Regards.

---

<div class="post-metadata">

**Author:** ![rajani.gangadhara](https://avatars.discourse-cdn.com/v4/letter/r/3be4f8/32.png) [@rajani.gangadhara](https://forum.katalon.com/u/rajani.gangadhara)\
**Post date:** [August 18, 2019, 9:27am UTC](https://forum.katalon.com/t/test-data-excel-binding-can-we-get-the-row-number-or-iteration-id-at-runtime/14456/5 "2019-08-18T09:27:29Z")

</div>

hello huynguyen,

I did not get answer on how to get current iteration id from the above link you shared as it leads to test case variables page which has no information on current iteration ID.  
Can you re share or mention how to current iteration number.

---

<div class="post-metadata">

**Author:** ![mdu\_kay7](https://avatars.discourse-cdn.com/v4/letter/m/958977/32.png) [@mdu\_kay7](https://forum.katalon.com/u/mdu_kay7)\
**Post date:** [September 2, 2019, 7:32am UTC](https://forum.katalon.com/t/test-data-excel-binding-can-we-get-the-row-number-or-iteration-id-at-runtime/14456/6 "2019-09-02T07:32:03Z")

</div>

I’m afraid this link is not helpful in getting the current active row during runtime

---

<div class="post-metadata">

**Author:** ![Ibus](https://avatars.discourse-cdn.com/v4/letter/i/e9a140/32.png) [@Ibus](https://forum.katalon.com/u/Ibus)\
**Post date:** [September 2, 2019, 10:14am UTC](https://forum.katalon.com/t/test-data-excel-binding-can-we-get-the-row-number-or-iteration-id-at-runtime/14456/7 "2019-09-02T10:14:47Z")

</div>

you can simply add one more column in your test data file having the index and map it to a tescase variable

---

<div class="post-metadata">

**Author:** ![kazurayam](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/kazurayam/32/333_2.png) [@kazurayam](https://forum.katalon.com/u/kazurayam)\
**Post date:** [September 3, 2019, 3:38am UTC](https://forum.katalon.com/t/test-data-excel-binding-can-we-get-the-row-number-or-iteration-id-at-runtime/14456/8 "2019-09-03T03:38:11Z")

</div>

> [@huynguyen](#):
>
> @Manjula_Siddanna, you can get the row or the iteration that is being worked on. Please refer to this guide [https://docs.katalon.com/katalon-studio/tutorials/data\_driven\_testing.html#what-is-data-driven-testing](https://docs.katalon.com/katalon-studio/tutorials/data_driven_testing.html#what-is-data-driven-testing) for more details.  
> Regards.

This url was previously titled as ‘What is data driven testing’, but now it is titled as “Test Case Variables”. The page content has been completely rewritten.

The previous content, I remember, mentioned that Katalon Studio equipped with 2 method of Data-driven testing, that is

**A. Execution from test suites**  
**B. Execute from a test case**

@huynguyen, when you say “you can get the row of the iteration that is being worked on”, I think you have the method _B. Execution from a test case_ in your mind.

However the revised content of the above url (and [https://docs.katalon.com/katalon-studio/docs/run-test-case-external-data.html](https://docs.katalon.com/katalon-studio/docs/run-test-case-external-data.html)) now mentions the method **A. Execution from the test suites** only. It no longer describes the method **B. Execution from a test case**.

I think, it is regretful that **B. Execution from a test case** is now disregarded, not described in the official document at all.

---

<div class="post-metadata">

**Author:** ![kazurayam](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/kazurayam/32/333_2.png) [@kazurayam](https://forum.katalon.com/u/kazurayam)\
**Post date:** [September 3, 2019, 3:46am UTC](https://forum.katalon.com/t/test-data-excel-binding-can-we-get-the-row-number-or-iteration-id-at-runtime/14456/9 "2019-09-03T03:46:45Z")

</div>

Why the method “B. Execute from a test case” has been ignored out of the offical document?

I guess a recent change at v6.3.0 is related to it:

> [@Method code too large](http://forum.katalon.com/t/method-code-too-large/9475/58):
>
> Hi @kazurayam, There are 2 problems in this topic: The issue relates to a test suite using data binding with large Test Data. We already fixed it. The issue relates to a test case contains 500-1000 lines of code. This is a Groovy limitation. We may try to improve but we also recommend users to separate the main script to multiple methods. Thanks.

At v6.3.0, a fix for “An issue related to running a test suite with too large test data” was included. I suppose the Katalon team was so deeply devoted into the method “A. Execution from test suites” that they forgot all about the method “B. Execution from a test case”.

---

<div class="post-metadata">

**Author:** ![mdu\_kay7](https://avatars.discourse-cdn.com/v4/letter/m/958977/32.png) [@mdu\_kay7](https://forum.katalon.com/u/mdu_kay7)\
**Post date:** [September 3, 2019, 10:35am UTC](https://forum.katalon.com/t/test-data-excel-binding-can-we-get-the-row-number-or-iteration-id-at-runtime/14456/10 "2019-09-03T10:35:52Z")

</div>

Thanks for the work-around. Does get the job done - in future I’ll look for a ‘cleaner’ way to do it and share it with the community. Thanks again

---

<div class="post-metadata">

**Author:** ![Dan\_Bown](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/dan_bown/32/20464_2.png) [@Dan\_Bown](https://forum.katalon.com/u/Dan_Bown)\
**Post date:** [September 5, 2019, 9:14pm UTC](https://forum.katalon.com/t/test-data-excel-binding-can-we-get-the-row-number-or-iteration-id-at-runtime/14456/11 "2019-09-05T21:14:56Z")

</div>

How about using a variable to bind Excel data at the Test Case level with optional bindings at Test Suite level (will override any variables set in Test Case level) if you had a need (eg different data)? Does this description make sense? 🙂

---

<div class="post-metadata">

**Author:** ![kazurayam](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/kazurayam/32/333_2.png) [@kazurayam](https://forum.katalon.com/u/kazurayam)\
**Post date:** [September 5, 2019, 9:44pm UTC](https://forum.katalon.com/t/test-data-excel-binding-can-we-get-the-row-number-or-iteration-id-at-runtime/14456/12 "2019-09-05T21:44:54Z")

</div>

> [@Dan\_Bown](#):
>
> bind Excel data at the Test Case level with optional bindings at Test Suite level (will override any variables set in Test Case level)

Sorry, I do not see what you want to do, how your code will look like.

---

<div class="post-metadata">

**Author:** ![Dan\_Bown](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/dan_bown/32/20464_2.png) [@Dan\_Bown](https://forum.katalon.com/u/Dan_Bown)\
**Post date:** [September 6, 2019, 8:53am UTC](https://forum.katalon.com/t/test-data-excel-binding-can-we-get-the-row-number-or-iteration-id-at-runtime/14456/13 "2019-09-06T08:53:55Z")

</div>

Hi kazurayam,  
now that I look, I see that what I am describing is very close to a DZone article - [https://dzone.com/articles/data-driven-testing-approach-with-katalon-studio](https://dzone.com/articles/data-driven-testing-approach-with-katalon-studio). My only change is at the third step though, instead of creating variables that have a string type, I use a test data value.  
The variable used in test case for example:  
Name = Var\_CustName  
Type = Test Data Value  
Default value = findTestData(“Customer\_Details”).getValue(“CustName”, 1)  
Part A of that article is then used to bind variables at test suite level.  
I only mention this approach as the DZone article seems to give a much simpler approach than Katalon’s own documentation but I wonder if it is affected by script length issue mentioned, when test data includes many rows.

---

<div class="post-metadata">

**Author:** ![Ibus](https://avatars.discourse-cdn.com/v4/letter/i/e9a140/32.png) [@Ibus](https://forum.katalon.com/u/Ibus)\
**Post date:** [September 6, 2019, 10:20am UTC](https://forum.katalon.com/t/test-data-excel-binding-can-we-get-the-row-number-or-iteration-id-at-runtime/14456/14 "2019-09-06T10:20:11Z")

</div>

@Dan_Bown using ‘findtestdata’ will ignore any binding. it is just the programatically way of using certain testdata, instead of maping it. and yeah, this approach may not create the ‘large code issue’ since at the runtime the behaviour is different, the data is iterated during the execution phase, not generated during the compile phase
