refactored write_to_excel to use the excel_data dict instead of a local dict for setting up excel tables