How do we create desired no. of new rows in between existing two rows in excel with POI v3.6 api? | Selenium Training|Java|WebDriver|TestNG|Frameworks|Videos

Selenium Training Forum

How do we create desired no. of new rows in between existing two rows in excel with POI v3.6 api?

R
Raj Kishore Post on 05/10/2019

Hi Ashish,

How do we create desired no. of new rows in between existing two rows in excel with POI v3.6 api? I saw for this if we have such method in our Xls_Reader file but there is no such method. Can you please let me know how do we create rows in between existing rows with POI v3.6 api.

Thank you,

Kishore

S

Instructor

Support Team Reply on 09/10/2019

If there is no data between the rows, then all you need to do is to add the data between the rows by specifying the row numbers.

In case you want to add new rows in the existing data. In that case, you need to write your own custom logic using our XLS reader to move data to the next row before adding a new row.

R
Raj Kishore Reply on 10/10/2019

Can you give me an example to move data to the next row if i want to add new rows in the existing data. Any help would be much appreciated.

Thank you,

Regards,

Kishore

S

Instructor

Support Team Reply on 11/10/2019

You can start from the last row and move it to the desired row by iterating over each cell. After that second last row to the next desired location and so on.