Calc document has changed into Writer document. How can this happen?

I maintain a spreadsheet on my desktop computer which I update daily. Yesterday I added an entry to the spreadsheet from my laptop computer over my WiFi network. I closed the spreadsheet and when asked if I wanted to save the details said I did. However the spreadsheet didn’t close and I got the revolving circle. I left it and came back to it later. The revolving circle and the file had disappeared. I thought I’d check that my entry had been saved so opened the file again.
The file that opened was not the one that I’d closed! Although the file name showed the .ods extension the page was headed “LibreOffice Writer” and was indeed a Writer document consisting of a blank page without any grid lines; all the data from my spreadsheet had disappeared. I looked at “Properties” which showed the file as an ods one even though it’s clearly a Writer document. Fortunately, I have a backup copy of the spreadsheet on an external drive but I’d be grateful if anyone could explain what could have happened to change the document type in this way with consequent loss of all data and whether such data can be recovered.

This can happen if the problem during saving was so severe that the file got completely corrupt. LibreOffice does not rely on file extension to select component used to open the file; it checks the internal file structure and then decides. So in case of severely damaged (possibly completely empty?) file, it cannot detect anything more suitable than “generic text document”, and opens Writer accordingly.

Thanks, Mike. Is this sort of think a rare occurrence, do you know?

The question is not answerable properly, actually.

If the event was something entirely random (like some radiation from space changing bits in memory, or a power surge), then yes, it’s something happening not too often (but power surges may be not uncommon in some areas). But it could happen that the problem is caused by some actual problem, like full drive; or not enough memory; or some bug in program not liking some combination of content or output format … and then me calling something “rare” would be misleading, because for this specific document or system it could be not so.

So it’s not correct to try to guess how rare this could be; instead, use proper backup of your important files, including creating backups when saving in LibreOffice (see OptionsLoad/SaveGeneral, Always create backup copy option).

A side note: please don’t use “Answer” for what is not an answer to your original question. It should have been a comment.

Thanks for the answer and for the information on using “comment” rather than “answer”. Hope I’ve got it right this time!