Split write_excel_csv into two functions, one for writing CSV,
one for writing Excel.

As a consequence it will write the whole of a CSV file before
starting to write an Excel file which may break.

Fixes #49