@Abhiram I would suggest you define your task again with a consistent example and a result you want to have - or you have another look at my example and see if you might adapt that (one idea could be to detect the last full row of the existing excel file and then appending the data).
The other example I could think of would involve using Python: