VBA to Upload single or multiple files to Google Drive Office

VBA to Upload single or multiple files to Google Drive Office Now coming to upload so first let's upload uh the line file so within this folders i've just put in some structure so that is easier to.

You know demonstrate so here is a file excel file of 32 kb only and then this one as well yeah so let's first upload this slide file into.

Expense folder um data and then this is gonna be expense data so we want to upload it into expense data and this is a small file so we will not.

Be able to see the progress that is um but you should get a status here okay so uh looks like it completed it says that.

Last uploaded id is this and then this status is completed and down here as well you can see it's completed and if you go in here you'll see that.

It's uh it's a basic file that has been uploaded now let's try and upload a more heavy file so if uh i want to show you the.

VBA to Upload single or multiple files to Google Drive

The size 72 mb okay um just to show the progress bar that is gonna show down there okay so we'll upload it to the same folder um i'm gonna just run this.

And if you observe down here you'll see that the progress is happening uh which you can you know easily adapt it with the progress bar as well but for now just to keep it simple i'm.

Just painting it here as you can see uh you'll be able to see the percentage it has been uploaded and the file is uploading so it's almost complete.

Sit down here it says completed and it shows up here okay so this file has been uploaded here and this is the same file size that i showed you down there.

Okay so uh quickly i'll upload multiple other files within the folder called multiple multiple files upload folder so you can easily reuse this code these are all different.

Type of files as a demonstration let's upload this to a folder called uh underdogs or others i think we call it others so others let's upload it to others.

    And basically this code is gonna use the

    You know file system object and then it's gonna loop through all the files within the folder and then it's gonna call the upload.

    Upload uh function which is here and then it's to pass the parent folder id and the file name it wants to upload so this is a file name.

    That gets while looping through the file and then uh if you want to specifically upload just you know for example you can get use this get extension name.

    Um function to get the extension of the file and then you can filter out let's say you want to upload only the pdf files or xo files you can use that but for now.

    I'm not going to filter out i've commented this out and then i'm going to upload this all the files within that folder to a folder called.

    Other so if you go to others folder there is nothing here now i'm gonna run this code this is going to be really quick so it's not going to show.

    The progress so as you can see here start printing that this file has been uploaded and then you'll be able to see up here as well these are the files that's getting.

    Uploaded so these are very uh you know like small size files so it's quite fast that's why okay now let me quickly walk you through.

    Uh this upload file uh you know local function which is used using this local upload file you know method and then.

    You just simply need to you know

    Initialize the service and then you can specify where you want to upload it to and the file name you want to upload to.

    And then this function itself has the file validation uh function which you can find it from here that functions non-api so these are all collections of useful functions that.

    You can utilize in any projects and then here this part is where you know it basically checks the library what is the status.

    This particular method will return what is the current status it will return the information whether it is failed completed or it is waiting to be pro you know like.

    Waiting for response not started yet and then if if it is uploading this will basically calculate total uploaded and then uh to process uh yeah so that will give us.

    Uh you know the percentage uh uploading percentage okay now we are done with upload we'll quickly go through download.

    DISCLAIMER: In this description contains affiliate links, which means that if you click on one of the product links, I'll receive a small commission. This helps support the channel and allows us to continue to make videos like this. All Content Responsibility lies with the Channel Producer. For Download, see The Author's channel. The content of this Post was transcribed from the Channel: https://www.youtube.com/watch?v=5ZktR4uABo4
Previous Post Next Post