What you're experiencing is likely related to auto-sync by the OneDrive desktop app.
If you have a Premium account, it makes a lot of sense to use the SharePoint actions in Power Automate Desktop to get the file, make changes to it locally, and then push the file back to SharePoint again. This is a significantly more reliable way of doing it than using the OneDrive desktop app to sync the directory.
If you do not have a Premium license, and have to use the OneDrive app for syncing, I recommend copying the file locally before making the changes, and then moving it back to the synced directory. This is because the auto-sync by OneDrive can also cause issues when saving your changes or writing to Excel in general. I have experienced these issues numerous times. So, use Copy file(s) to copy it locally, then do what you want to do with it, and then use Move file(s) to move it back.