Mount Microsoft OneDrive to Google Colab

PHOTO EMBED

Sun Apr 24 2022 13:33:43 GMT+0000 (UTC)

Saved by @hasitha #colab #onedrive #rclone

#Run this from cmd.
$ rclone authorize "onedrive"

# Download & Install Latest Setup
!curl https://rclone.org/install.sh | sudo bash

# Authenticate One Drive
!rclone config

# Mount One Drive
#To stream files we need to mount One Drive.
!sudo mkdir /content/onedrive
!nohup rclone --vfs-cache-mode writes mount onedrive: /content/onedrive &
content_copyCOPY

Microsoft OneDrive connection stops working after 1 hour when the access token expires. I eventually found a somewhat hacky solution. The refresh tokens from the python msal lib https://github.com/AzureAD/microsoft-authentication-library-for-python

https://www.youtube.com/watch?v=U6YPgARhRzA