0

I've been searching how to do this, but i didn't find anything. After a while, i came up with the script i'll post as an answer. I'm posting this for myself and anyone who might find it useful.

You'll need to get a dropbox access token, that can be obtained after creating a dropbox app.

1 Answer 1

1
function send2dropbox(file) { var dropboxTOKEN = 'XXXxxx'; var path = '/somePath/' + file.getName(); var dropboxurl = 'https://api.dropboxapi.com/2/files/save_url'; var fileurl = 'https://drive.google.com/uc?export=download&id=' + file.getId(); var headers = { 'Authorization': 'Bearer ' + dropboxTOKEN, 'Content-Type': 'application/json' }; var payload = { "path": path, "url": fileurl } var options = { method: 'POST', headers: headers, payload: JSON.stringify(payload) }; var response = UrlFetchApp.fetch(dropboxurl, options); return response; } 

You can find an example HERE

Sign up to request clarification or add additional context in comments.

1 Comment

Note that this codes uses Dropbox API v1, which is deprecated and being retired soon. You should use Dropbox API v2 instead. The relevant endpoint in this case is /2/save_url.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.