Please try to use the filepath like the below: https://tenant.sharepoint.com/sites/test/Shared%20Documents/file.xlsx. Read this post for details: https://stackoverflow.com/questions/51029214/opening-excel-file-from-sharepoint-as-read-write
Besides, you could try to use ActiveWorkbook.LockServerFile in your code to enable edit: https://stackoverflow.com/questions/45163549/excel-2016-sharepoint-file-still-opens-as-readonly/45171431#45171431
If an Answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.