Added a function to write to an excel file