Struggling excel read and write

I am struggling to read excel and write , specified the input and output structure.
Please suggest how we can do it.

Input :

Column-0 Column-1 Column-2 Column-3
SL “Case Number
Filing Date
Diary No.” Party and Advocate details Party and Advocate details
1 Case1 Petitioner Advocate1
1 Case1 Pet. Advocates PAdvocate1
1 Case1 Respondants Resp1
1 Case1 Res. Advocates Res.Adv1
2 Case2 Petitioner Advocate2
2 Case2 Pet. Advocates PAdvocate2
2 Case2 Respondants Resp2
2 Case2 Res. Advocates Res.Adv2
3 Case3 Petitioner Advocate3
3 Case3 Pet. Advocates PAdvocate3
3 Case3 Respondants Resp3
3 Case3 Res. Advocates Res.Adv3
4 Case4 Petitioner Advocate4
4 Case4 Pet. Advocates PAdvocate4
4 Case6 Respondants Resp4
4 Case7 Res. Advocates Res.Adv4

Output :
Column-1 Column-2 Column-3 Column-4 Column-5
Case Petitioner Pet. Advocates Respondants Res. Advocates
Case1 Advocate1 PAdvocate1 Resp1 Res.Adv1
Case2 Advocate2 PAdvocate2 Resp2 Res.Adv2
Case3 Advocate3 PAdvocate3 Resp3 Res.Adv3
Case4 Advocate4 PAdvocate4 Resp4 Res.Adv4

Your challenge is not with the reading/writing excel, it is the logic. You can try the following logic, don’t use for each row, use while loop.The below is only the logic, you need to find out the exact syntax.

Open excel
noOfRows = excel.rowcount
intRow = 0
strCase = “”
while (intRow < rowcount)
case = excel.row(intRow).col(x)
while (case = excel.row(intRow).col(x))
Write to new excel
case = excel.row(intRow).col(x)


what value contain the col(x)

If your input file is in the following format, then x is 0