My CLI script opens, writes to a sheet and saves an existing Excel document six times (add one sheet and update five sheets) before it's complete.
While my script was running, I realized I had an error in my code. I canceled using CTRL-C. After canceling, the existing Excel file exhibited this error on the next run of the CLI script:
`("There is no item named '[Content_Types].xml' in the archive")`
None of this error message makes any sense in terms of my script or the file.
I realized canceling my script must have corrupted the Excel file.
To address this I think I should workup some sort of temp file process--such as:
What is the recommended best practice?
- make a temp file, open the original, work on the original, if error, restore to temp.
- make a temp file, work on the temp file, overwrite temp if no errors.
- or something else?