CHange the order of arguments for to_csv to use same logic when sheet is optional last element