This tutorial is basically about Google Drive App Script.
However, one of the Google services is the Drive service which allows scripts to create, find and modify files and folders in google
Here, we will learn how to start with app script and how to use app script to create files in the drive, delete it, check its properties and share.
So, if you wanna know more about apps script you can visit Google App Script page https://developers.google.com/apps-script/
Therefore, this is the main page of google app script documentation, it has all the details to get started with App Script.
Similarly, it has tutorials, all the news, and updates on all the new features of the product and has all the details about all the services and functions you can use.
Write your Script
To write your app script you need to go to https://script.google.com and click on New Script. Which will open a script editor page where you can write your scripts.
Script to Loop Through All Files in Google Drive Folder
In my Drive I have a folder ‘TestFolder’ which contains four image files as you can see in image below.
Hence, after executing the script you can see the output in log window
Move a File From One Folder to Another Folder
Create Files in Drive
Now, let’s write script to create a file in drive,
App Script has three methods to create files in Drive.
- DriveApp.createFile(name, content);
- DriveApp.createFile(name, content, mimeType)
Deleting Files From Drive
Look through previous post “Google Apps Script to create and delete folder in Google drive” to delete files permanently.
For sharing files you can use below methods.
I hope Now you can create/delete and share files in the Google Drive with App Script, Let me know for any query in comment box or email me at email@example.com
Thanks for Visiting!