Google Apps Script Tutorial to Upload Video From Google Drive to Youtube Using Javascript
Dec 21, 2025
Check the full description to find both links for payment in inr at stripe or usd at paypal all links are there:
Buy the full source code of the application at Paypal in USD Currency here:
https://procodestore.com/index.php/product/google-apps-script-tutorial-to-upload-video-from-google-drive-to-youtube-using-javascript-2/
Buy the full source code of the application at Stripe in INR Currency here:
https://buy.stripe.com/aEUaHYd3z0Ok8jC0GY
Show More Show Less View Video Transcript
0:00
Uh hello friends, today in this tutorial
0:02
I will be showing you that how basically
0:04
you can upload a video which is present
0:06
inside your Google drive to directly to
0:08
YouTube as a private or public video
0:11
accordingly. So you can see that this is
0:14
my YouTube channel here bas basically it
0:16
doesn't contain any video out there. No
0:19
video is present. Now let me uh run this
0:22
Google app script. Basically Google
0:23
appcript is just a platform where you
0:26
can directly interact with all the
0:27
Google APIs such as Google Drive,
0:29
YouTube API, Gmail API, spreadsheet. So
0:33
you can see this is my video here which
0:35
is hosted on Google Drive and basically
0:37
I need to directly upload this video to
0:40
YouTube as a private video. So you will
0:43
need this uh video ID guys of this uh
0:45
Google Drive video. So anytime basically
0:48
if you upload a video here, let me show
0:50
you. You select that video and right
0:52
click at and simply click on get link.
0:56
So you will get this link of this video
0:58
guys. Basically if you just copy this
0:59
link and paste it in the browser and
1:02
basically you just need this ID here
1:04
which is there. This is the ID that you
1:07
see for every video. So simply copy this
1:09
ID guys and simply we need to paste this
1:12
ID here which is this ID. You will see
1:14
that. So here inside this code I will
1:17
paste it and then basically the privacy
1:20
status you will see it is private and if
1:21
I now run this script here basically it
1:24
will it will run this script and
1:26
execution started you will see that and
1:29
now after that it will return me you can
1:31
see if I refresh it basically a video
1:34
will be there here automatically
1:36
published here you will see the title is
1:38
summer location you can see whatever
1:40
title that we need to give here 95
1:42
processing and you will see it will be a
1:46
private video. So you will see that
1:48
after processing is complete. It will
1:51
label this visibility as private. So
1:53
automatically our video is uploaded guys
1:56
to YouTube. You don't need to manually
1:57
do this process. So it's very simple.
2:01
So it's just processing it and uh then
2:04
the visibility will change to the
2:07
private. You will see that if you see
2:10
this the details section and basically
2:12
you will see uh the title you can
2:14
customize the title here. You can change
2:16
the description of the video. You can
2:18
even put tags here category ID and then
2:21
you can put the
2:23
private status. So then we are simply
2:26
using the insert method guys of the
2:28
YouTube data API which offers this uh
2:30
direct method to upload it to the
2:32
YouTube. You will see now it changed to
2:34
private here. So you can see uh what
2:38
private video simply means that this
2:40
video will not appear on your channel or
2:42
search results. Only you have the access
2:44
to view this video. So you can even uh
2:46
just directly publish a public video as
2:49
well. If I open this on YouTube, you
2:51
will see that this is a video and which
2:53
is hosted here. You will see that
2:56
now it is 16 second video is there. So
2:59
very simple process. You need to simply
3:01
run the script Google app script if you
3:03
want to directly publish videos from
3:05
your Google drive directly to YouTube as
3:07
a private video. So I have given this
3:09
source code in the description of this
3:11
video guys. So if you want to read all
3:12
the blog post step by step instruction
3:14
is given here and all the source code is
3:16
also given. So if you really want to get
3:18
this source code go to the description
3:19
of this blog post. So now let me start
3:22
building the script guys. As I already
3:24
told you this these are all Google APIs.
3:26
So Google has developed specifically
3:29
Google appcript for writing
3:32
directly interacting with Google APIs.
3:34
So it's a special scripting platform and
3:37
all that code is similar to JavaScript.
3:39
If you know JavaScript, you can write
3:41
code here. Simply go to here and click
3:43
on start scripting. And here we need to
3:45
create a brand new project here guys. So
3:47
simply click on brand new project and
3:49
here we can start our coding process. So
3:52
it's very simple. So we will write a
3:55
function here which will be called as
3:59
upload
4:00
video to YouTube. So this is a function.
4:04
You can name this function anything
4:06
accordingly. Just make your function.
4:08
After this guys we will get the source
4:10
file video file that we need to say. And
4:13
for this guys we need to use the drive
4:15
app. Basically this is the API of Google
4:18
drive and it contains a lot of methods.
4:20
You can get the video file or any sort
4:22
of file by its ID. This is a method
4:25
which is used here. Drive file sorry
4:27
drive app dot get file by its ID. So
4:31
again I have shown you how to get the
4:32
ID. So simply copy this ID here if you
4:35
want to upload this. So simply I will
4:37
paste this ID.
4:39
So after this we will simply
4:44
now to get this blob object guys it's
4:46
very simple. Now to get the blob object
4:49
we will simply invoke a method called as
4:52
get blob. So it will actually convert
4:54
the video return the data from this
4:57
video to a blob object. That's it. So
5:00
after you do this it's very simple.
5:06
This is now complete here. And after
5:08
this we need to create a object for the
5:12
video. So this will contain useful
5:15
information about the video such as
5:17
title, description, tax. So we can give
5:20
it a title for the video. Let's suppose
5:22
I give here sample
5:24
whiteboard
5:28
whiteboard video. So I give this title.
5:31
Put a comma and you need to give a a a
5:34
short little description. This will be
5:37
this is the description of
5:41
the whiteboard video.
5:44
So put a comma and then you need to put
5:46
a tax here out there. So you can put a
5:48
tax out there. Let's suppose surfing or
5:52
send or we can simply say here
5:55
whiteboard
5:58
animation
6:02
and also you can put a category ID guys
6:04
as well.
6:06
So there are different categories out
6:08
inside YouTube technology, education. So
6:11
you can just name just give it the
6:14
category ID as well. So let me give it
6:16
22.
6:17
So each category have a different number
6:19
assigned to it. So just read the
6:21
documentation and depending upon that
6:23
just give it.
6:25
So after you put this object guys we
6:28
need to put the status of the video as
6:30
well. This will be again a object which
6:32
contains a property called as privacy
6:35
status.
6:37
So this can be either be public or
6:40
private or unlisted. So I will provide
6:43
it as private. You will see that
6:50
sorry I think tax is category. You need
6:54
to put a comma here.
7:00
Uh let me see why it is creating the
7:03
problem. And we paste it here.
7:15
So
7:20
let me paste this guys. I think I have
7:22
made a mistake here in writing this.
7:29
Okay. Okay. I forgot to enclose this.
7:33
Yeah, this is
7:38
okay. I need to surround this status
7:39
property guys inside the category
7:41
itself. So that's why the error was
7:44
coming. So now you can see there's a
7:46
status property here. You can see that
7:48
inside our video resource. So this is
7:50
our object guys which contains these
7:52
five properties title, description,
7:54
tags, category, ID and the status of the
7:56
video. After you have this object guys,
7:58
you will simply insert this video inside
8:01
YouTube. So we have a now we will
8:04
interact with the YouTube API. So there
8:06
is a YouTube here and here YouTube
8:08
videos and this contains a method called
8:11
as insert guys and basically
8:15
this method takes our video object video
8:17
resource and then basically it it
8:22
returns the snippet and the status. So
8:25
whether the video is uploaded or not and
8:28
then basically we will pass the name of
8:30
the video the video itself which is
8:33
contained inside source file. That's it.
8:35
Now you can console log the response
8:38
coming from the API whether it's
8:40
uploaded or not console logging it. This
8:42
is not complete guys. So if you save
8:44
this and before running this project
8:46
guys uh line number 11 some kind of
8:50
error take place. Yeah, that's that's
8:52
because uh I have spelled something not
8:55
right. This needs to be
8:58
YouTube.
9:03
So simply save this. So
9:07
unexpected.
9:14
Let me copy this.
9:20
You can see that insert and this
9:28
I think you need to add the services
9:29
guys here that's why it is creating a
9:31
problem. So now we need to interact with
9:33
the Google API. So we need to add them.
9:35
So in the left hand side in the services
9:37
tab you need to add individual service
9:39
here which is first of all we will add
9:41
the drive API that you see right here.
9:44
So this is a Google drive API. Simply
9:46
click on add. So this will add your
9:48
service of Google drive so that you can
9:50
use fetch the video file from the drive
9:53
and also you need to add our uh YouTube
9:56
data API. Simply click on add. So this
9:59
will also add the service here. So upon
10:01
adding this simply click on save.
10:04
Uh what is I think
10:12
let me paste there some I think why it
10:15
is creating so much error. Let me change
10:18
the title.
10:20
Sample whiteboard video.
10:26
This is the description.
10:42
So now if you click on save here,
10:46
so your project is saved guys. So it was
10:49
just a writing mistake. So now if you
10:52
click on the run option guys, there is a
10:54
run option to run your script. And now
10:55
it will ask for the permissions. So
10:57
whenever you run for the very first time
10:59
guys, it will ask for some of the
11:00
permissions to run. So you need to allow
11:04
those permissions if you want to run
11:07
your project.
11:12
So you can see authorization required.
11:14
So click on this and basically
11:17
it's your own project. So simply go to
11:19
advance and this one. So it is
11:22
completely safe and you can see it is
11:24
asking you to give the permissions. So
11:26
see and download all your Google Drive
11:28
files and manage your YouTube account so
11:30
that it can upload and delete files. So
11:33
simply click on allow and
11:36
you can see execution started and
11:39
basically after uploading it will return
11:41
this object to us which is this
11:43
thumbnail title which is if I now
11:45
refresh it go to my video section you
11:48
will now see
11:54
sample whiteboard video. So whatever
11:55
title I given here you can see that now
11:58
it is processing it and basically after
12:00
processing it
12:02
you can see private video is uploaded.
12:05
So in this easy way guys you can upload
12:06
any video which is hosted on Google
12:08
drive directly to YouTube using this
12:11
simple script Google app script that I
12:12
shown you with the simple title
12:14
description and you can even change the
12:17
status to public private or unlisted. So
12:20
all the source code is given in the
12:22
description of this video and please hit
12:24
that like button, subscribe the channel
12:26
and I will be seeing you in the next
