Each file opened in OneDrive/SharePoint gets downloaded to the computer, this can eventually take up a lot of space, and MacOS does not offer any automatic file cleanup options.
By freeing up space we are instructing OneDrive to ensure files are uploaded to the cloud and remove local copies. This frees up space by un-caching files that haven't been used recently, and files that are opened following this are re-downloaded.
To do this open finder
and navigate to your shared folder. Right click and select "Free Up Space":This process will take some time but it will free up disk space automatically.