Help in order to achieve the below Requirement in test Case

I have requirement where the Web UI screen has following

Department : FINANCE
LIST OF EMPLOYEE : XXX
ABC

I have to prepare excel which must contain value as

DEP EMPLOYEE
FINANCE XXX
FINANCE ABC

How to iterate the excel so when it goes to second row excel it should not recreate FINANCE rather than Add ABC

If the contents of a cell must have FINANCE in it as well as the employee reference, then you could use the String method, split, like in the below:
// get the person’s last name: smith, john
userLastName = (GV.gHostName).split(’,’)[0];

In your case, if I gather correctly, you would want:

emp = xcelContent.split(’ ')[1]; // there is a space between the single quotes; gets XXX or ABC

At the same time, you could also get the department reference:
dept = xcelContent.split(’ ')[0]; // you don’t need to get this if you don’t want it; gets FINANCE