skip to Main Content

How to write multiple data in an excel sheet in an iterative manner?

You can write excel data in an iterative manner with the help of for loop.

Lets say we have a sample excel file as shown below in which you want to enter data in an iterative manner.

This image has an empty alt attribute; its file name is read2-1.png

Assuming you want to enter some value in the count column and the expected output in the excel sheet will be something like below:

This image has an empty alt attribute; its file name is count.png

To achieve this please follow the steps below:

Step 1: Load the excel file using loadexcel function.

This image has an empty alt attribute; its file name is image-320-1024x479.png

Step 2: Set a variable with sequence number to iterate one by one and to initialize the variable.

This image has an empty alt attribute; its file name is image-321-1024x476.png

Step 3: Get the number of rows in the excel sheet which will be used in the for loop as the end index.

This image has an empty alt attribute; its file name is image-346-1024x369.png

Step 4: Start for loop with startindex as 0 and end index as total number of rows in the excel sheet. Here it will be ${rowcount}

This image has an empty alt attribute; its file name is image-322-1024x473.png

Step 5: Set the sequence number variable again to be iterated inside for loop.

This image has an empty alt attribute; its file name is image-323-1024x473.png

Step 6: Define a variable and use setsetvalue function to set the data in the excel sheet.

This image has an empty alt attribute; its file name is image-349-1024x478.png

Here, data is being written in the count column of the excel sheet one by one starting from the first index. ${count} refers to the current sequence number coming from the sequence number function as the input data and the next ${count} refers to the index of the excel sheet that at which index this data will be entered.

Syntax for getcellvalue is Key=Input Value.Index

Step 7: This step will mark the end of for loop.

This image has an empty alt attribute; its file name is image-345-1024x461.png

So the complete test case will look as below:

This image has an empty alt attribute; its file name is image-344-1024x386.png

To know more about the specific functions used in the above use case please refer this link.

Link: https://huloop.ai/docs/beatblip-commands/

Back To Top