Recover deleted data/document could not be locked

I’m trying to open a spreadsheet in LibreOffice but when trying to do so a window pops up that says: “document could not be locked - The lock file could not be created for exclusive access by LibreOffice, due to missing permission to create a lock file on that file location or lack of free disk space.” I only have the option to open a read-only version, but that version deleted my past 2 days of data. Is there anyway to recover this and then prevent the program from deleting my saved data next time I open the program? I’ve been using this file for the last 2 months with no problems and it just started giving me this issue.

Check whether there is already a lock file due to a previous unexpected stop (may be crash) of LibreOffice, which prevents from creating a new one. If you are using Windows, you may need to configure option “Show hidden files” in Windows Explorer (File Manager) to be able to see the lockfile named “.~lock.<name_of_file>#”. If this exists, while your file is not opened in LibreOffice and has an old date, delete the existing old lock file. Addition: The lock file is located in the same directory as your file.

This worked just fine for me:

  • Find document in Finder
  • Click “Get Info” and ensure the “Locked” tick box is NOT SELECTED.
  • In the Finder, change the name of the document (I removed a comma)
  • Open the document. Mine was then editable.

I use MacBook Pro, Big Sur, version 11.7
LibreOffice version 7.3.5.2

The issue occurred after a brief power outage. Documents were open at the time.