Wrote the loops for the excel generator