How can we Upload Video to google drive and get link of that video in response?

How can we give the function in-app that users can upload a video to my google drive and after upload get success we get a video link of google drive in response so we can use that link for further functions?
There is an Extension available for image upload but how can we upload video or any other file.

Have a look at this :point_down: tutorial by @TimAi2

HOWTO - Upload Any File to Google Drive !

Hope it helps :+1:

Thank you for your reply, Through this tutorial I successfully uploaded the file on drive but not getting file url in return. Through this I can only getting " Upload successfully " message.

Edit the last two lines of your web app script:


return ContentService.createTextOutput(“Your File Successfully Uploaded”);


var FILEID = DriveApp.getFolderById(’’).createFile(blob).getId();
return ContentService.createTextOutput(FILEID);

This will return the file ID of the uploaded file, you can build a url with that:<FILEID>

Bear in mind that this method may only allow files < @ 5mb in size (this is a Google thing)

1 Like

I used this code but still won’t work

function doPost(e) {
var data = Utilities.base64Decode(;
var blob = Utilities.newBlob(data, e.parameters.mimetype, e.parameters.filename);
var fileId = DriveApp.getFolderById(‘1x3PI6ervKj7RO5qhPRR5GJrhJ6RsTdkd’).createFile(blob).getId();
return ContentService.createTextOutput(fileId);

It is showing Reference Error: file is not defined

The script works OK for me here. Check if:

a) the file is uploaded
b) how you are handling the responseContent for web1.gotText

I am using your Aia Only and in both script file uploaded successfully and in 1st script Text output also come correct but in 2nd script Id is not coming… And I am just setting label text to response content when Web1 Text Got.

Is the file uploaded in both cases ?
What size is the file ? (Perhaps try with a small image instead if uploading large videos)

Also, have you updated your web app script correctly:

1 Open the script project
2 Go to Publish
3 Deploy as Web App
4 Project version: - select New from the dropdown
5 Execute the app as: your google account address (email)
6 Who has access to the app: Anyone, even anonymous
7 Press the Update button

You have to do this EVERY TIME you change your script

I think that you should use firebase storage or cloudinary for uploading videos and getting direct link

In which case, please provide the OP with full instructions on how to do this. The OP should be made aware of the potential costs associated with your suggestion…

1 Like

Hi. Why don’t you want to upload to the server with ftp?