@Gokul001 the solution is works fine. But the input excel after reading is as shown in below image:
The
Output required is