made a new function to write to xls, might use in views as well, needs more update