in reply to Open Excel while writing & Save file
It might be less fragile if you saved the data to a TSV file and imported it into Excel at the end of the process. If you turned autoflushing on for the TSV file handle, there would be next to no data loss on failure.