Dear Dalnice,
Good day! Thank you for posting your query in our community.
As per your description, it seems that you have pinned excel file from OneDrive, however, it disappears after one use from the pinned list.
If my understanding is right, we've also done a quick test in Current Channel version 2111(Build 1471.20226) of Excel on our side, and files remain in the pinned list after closing, below attached is screenshot of the test result for your reference:

May I know if you are trying to pin file in Excel as shown above? If yes, we'd recommend try following methods and check the outcome:
Please open Excel application in safe mode.
Then pin a file to check the outcome, if it works, it should be caused by Excel add-ins, please refer to this article to delete add-ins.
Please try Online Repair and see if the issue can be fixed. For detailed steps, please refer to this article.
You can open your Windows under clean boot, a "clean boot" starts Windows with a minimal set of drivers and startup programs, so that you can determine whether a background program is interfering with your game or program. How to perform a clean boot in Windows (microsoft.com)
We've also found some similar threads in this community, please try the below steps in this thread to check the outcome:

If the issue still persists, or if the scenario above is not consistent with yours, you can also post back and point that. At meantime, please provide us below information for further investigation:
What is the current version of your Office? In Excel, please click File>Account, please share a full screenshot of Product Information with us.
If other Office applications have the same behavior, like Word/PowerPoint.
Would you please share your pin steps with us to do test on our side?
Your understanding and patience will be highly appreciated. I hope that you are keeping safe and well!
Sincerely,
Rhoda | Microsoft Community Moderator