KEMBAR78
Drive Service - Apps Script - Google For Developers | PDF | Computer File | Data Management
0% found this document useful (0 votes)
22 views23 pages

Drive Service - Apps Script - Google For Developers

The Drive Service in Google Apps Script allows scripts to create, find, and modify files and folders in Google Drive, with an advanced service available for more features. Users must enable the Drive API in their Cloud project, and Google Workspace Administrators can restrict access to the Drive SDK. The document also outlines various classes and methods available for file and folder manipulation within Google Drive.

Uploaded by

luis
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views23 pages

Drive Service - Apps Script - Google For Developers

The Drive Service in Google Apps Script allows scripts to create, find, and modify files and folders in Google Drive, with an advanced service available for more features. Users must enable the Drive API in their Cloud project, and Google Workspace Administrators can restrict access to the Drive SDK. The document also outlines various classes and methods available for file and folder manipulation within Google Drive.

Uploaded by

luis
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 23

6/27/25, 10:10 AM Drive Service | Apps Script | Google for Developers

Drive Service
This service lets scripts create, find, and modify files and folders in Google Drive. Although
the built-in Drive service is easier to use, it has some limitations. For the most up-to-date
features and support, and to access files or folders in shared drives, use the advanced Drive
service (/apps-script/advanced/drive).

If your script uses a standard Cloud project


(/apps-script/guides/cloud-platform-projects#standard) instead of a default Cloud project, you
must manually turn on the Drive API. In your standard Cloud project, turn on the Drive API:

Turn on the Drive API (https://console.cloud.google.com/apis/enableflow?apiid=drive.googleapis.com)

The following code sample shows how to log the names of each file in the user's My Drive
folder:

// Logs the name of every file in the user's Drive.


var files = DriveApp.getFiles();
while (files.hasNext()) {
var file = files.next();
console.log(file.getName());
}

Note: Google Workspace Administrators can turn off the Drive SDK (/drive) for their domain, which
prevents their users from installing and using Google Drive apps. This setting also prevents users from
using Apps Script scripts, web apps and add-ons that use the Drive service
(/apps-script/reference/drive) or Advanced Drive Service (/apps-script/advanced/drive) (even if the add-
on or web app was installed before the admin turned off the Drive SDK (/drive)).

However, if an add-on using the Drive service is published for domain-wide installation and is installed by
the administrator for some or all users in the domain, or any script that has its OAuth client allowlisted
(https://support.google.com/a/answer/162106) by the domain administrator, the add-on functions for
those users even if the Drive SDK (/drive) is turned off in the domain.

Classes
Name Brief description

https://developers.google.com/apps-script/reference/drive 1/23
6/27/25, 10:10 AM Drive Service | Apps Script | Google for Developers

Access An enum representing classes of users who can access a


(/apps-script/reference/drive/access) file or folder, besides any individual users who have been
explicitly given access.

DriveApp Allows scripts to create, find, and modify files and folders in
(/apps-script/reference/drive/drive-app) Google Drive.

File (/apps-script/reference/drive/file) A file in Google Drive.

FileIterator An iterator that allows scripts to iterate over a potentially


(/apps-script/reference/drive/file-iterator) large collection of files.

Folder A folder in Google Drive.


(/apps-script/reference/drive/folder)

FolderIterator An object that allows scripts to iterate over a potentially


(/apps-script/reference/drive/folder- large collection of folders.
iterator)

Permission An enum representing the permissions granted to users


(/apps-script/reference/drive/permission) who can access a file or folder, besides any individual users
who have been explicitly given access.

User (/apps-script/reference/drive/user) A user associated with a file in Google Drive.

Access (/apps-script/reference/drive/access)

Properties

Property Type Description

ANYONE Enum Anyone on the Internet can find and access.

ANYONE_WITH_LINK Enum Anyone who has the link can access.

DOMAIN Enum People in your domain can find and access.

DOMAIN_WITH_LINK Enum People in your domain who have the link can access.

PRIVATE Enum Only people explicitly granted permission can access.

DriveApp (/apps-script/reference/drive/drive-app)

https://developers.google.com/apps-script/reference/drive 2/23
6/27/25, 10:10 AM Drive Service | Apps Script | Google for Developers

Properties

Property Type Description

Access Access An enum representing classes of users who can


(/apps-script/reference/drive/access) access a file or folder, besides any individual users
who have been explicitly given access.

PermissionPermission An enum representing the permissions granted to


(/apps- users who can access a file or folder, besides any
script/reference/drive/permission) individual users who have been explicitly given
access.

Methods

Method Return type Brief descrip

ntinueFileIterator(continuationToken) FileIterator Resumes a fi


apps-script/reference/drive/drive- (/apps- iteration usin
app#continueFileIterator(String)) script/reference/drive/file- continuation
iterator) from a previ
iterator.

ntinueFolderIterator(continuationToken) FolderIterator Resumes a f


apps-script/reference/drive/drive- (/apps- iteration usin
app#continueFolderIterator(String)) script/reference/drive/folder- continuation
iterator) from a previ
iterator.

eateFile(blob) File Creates a file


apps-script/reference/drive/drive-app#createFile(BlobSource)) (/apps- root of the u
script/reference/drive/file) Drive from a
Blob of arbi
data.

eateFile(name, content) File Creates a tex


apps-script/reference/drive/drive-app#createFile(String,String)) (/apps- the root of th
script/reference/drive/file) user's Drive
given name
contents.

eateFile(name, content, mimeType) File Creates a file


apps-script/reference/drive/drive- (/apps- root of the u
app#createFile(String,String,String)) script/reference/drive/file) Drive with th
name, conte
MIME type.

https://developers.google.com/apps-script/reference/drive 3/23
6/27/25, 10:10 AM Drive Service | Apps Script | Google for Developers

eateFolder(name) Folder Creates a fo


apps-script/reference/drive/drive-app#createFolder(String)) (/apps- the root of th
script/reference/drive/folder)user's Drive
given name.

eateShortcut(targetId) File Creates a sh


apps-script/reference/drive/drive-app#createShortcut(String)) (/apps- to the provid
script/reference/drive/file) Drive item ID
returns it.

eateShortcutForTargetIdAndResourceKey(target File Creates a sh


Id, targetResourceKey) (/apps- to the provid
apps-script/reference/drive/drive- script/reference/drive/file) Drive item ID
app#createShortcutForTargetIdAndResourceKey(String,String)) resource key
returns it.

forceSingleParent(value) void Enables or d


apps-script/reference/drive/drive- enforceSing
app#enforceSingleParent(Boolean)) behavior for
affecting ite
parents.

tFileById(id) File Gets the file


apps-script/reference/drive/drive-app#getFileById(String)) (/apps- the given ID.
script/reference/drive/file)

tFileByIdAndResourceKey(id, resourceKey) File Gets the file


apps-script/reference/drive/drive- (/apps- the given ID
app#getFileByIdAndResourceKey(String,String)) script/reference/drive/file) resource key

tFiles()
(/apps-script/reference/drive/drive-app#getFiles()) FileIterator Gets a collec
(/apps- all files in the
script/reference/drive/file- Drive.
iterator)

tFilesByName(name) FileIterator Gets a collec


apps-script/reference/drive/drive-app#getFilesByName(String)) (/apps- all files in the
script/reference/drive/file- Drive that ha
iterator) given name.

tFilesByType(mimeType) FileIterator Gets a collec


apps-script/reference/drive/drive-app#getFilesByType(String)) (/apps- all files in the
script/reference/drive/file- Drive that ha
iterator) given MIME

tFolderById(id) Folder Gets the fold


apps-script/reference/drive/drive-app#getFolderById(String)) (/apps- the given ID.
script/reference/drive/folder)

https://developers.google.com/apps-script/reference/drive 4/23
6/27/25, 10:10 AM Drive Service | Apps Script | Google for Developers

tFolderByIdAndResourceKey(id, resourceKey) Folder Gets the fold


apps-script/reference/drive/drive- (/apps- the given ID
app#getFolderByIdAndResourceKey(String,String)) script/reference/drive/folder)resource key

tFolders() FolderIterator Gets a collec


apps-script/reference/drive/drive-app#getFolders()) (/apps- all folders in
script/reference/drive/folder- user's Drive.
iterator)

tFoldersByName(name) FolderIterator Gets a collec


apps-script/reference/drive/drive- (/apps- all folders in
app#getFoldersByName(String)) script/reference/drive/folder- user's Drive t
iterator) have the give
name.

tRootFolder() Folder Gets the fold


apps-script/reference/drive/drive-app#getRootFolder()) (/apps- the root of th
script/reference/drive/folder)user's Drive.

tStorageLimit() Integer Gets the num


apps-script/reference/drive/drive-app#getStorageLimit()) bytes the us
allowed to s
Drive.

tStorageUsed() Integer Gets the num


apps-script/reference/drive/drive-app#getStorageUsed()) bytes the us
currently sto
Drive.

tTrashedFiles() FileIterator Gets a collec


apps-script/reference/drive/drive-app#getTrashedFiles()) (/apps- all the files in
script/reference/drive/file- trash of the
iterator) Drive.

tTrashedFolders() FolderIterator Gets a collec


apps-script/reference/drive/drive-app#getTrashedFolders()) (/apps- all the folder
script/reference/drive/folder- trash of the
iterator) Drive.

archFiles(params) FileIterator Gets a collec


apps-script/reference/drive/drive-app#searchFiles(String)) (/apps- all files in the
script/reference/drive/file- Drive that m
iterator) given search
criteria.

https://developers.google.com/apps-script/reference/drive 5/23
6/27/25, 10:10 AM Drive Service | Apps Script | Google for Developers

archFolders(params) FolderIterator Gets a collec


apps-script/reference/drive/drive-app#searchFolders(String)) (/apps- all folders in
script/reference/drive/folder- user's Drive t
iterator) match the g
search criter

File (/apps-script/reference/drive/file)

Methods

Method Return type Br

dCommenter(emailAddress) File Ad
apps-script/reference/drive/file#addCommenter(String)) (/apps-script/reference/drive/file) lis
Fi
(/
sc
.

dCommenter(user) File Ad
apps-script/reference/drive/file#addCommenter(User)) (/apps-script/reference/drive/file) lis
Fi
(/
sc
.

dCommenters(emailAddresses) File Ad
apps-script/reference/drive/file#addCommenters(String)) (/apps-script/reference/drive/file) us
co
(/
sc
.

dEditor(emailAddress) File Ad
apps-script/reference/drive/file#addEditor(String)) (/apps-script/reference/drive/file) lis
(/
sc
.

dEditor(user) File Ad
apps-script/reference/drive/file#addEditor(User)) (/apps-script/reference/drive/file) lis
(/
sc
.

https://developers.google.com/apps-script/reference/drive 6/23
6/27/25, 10:10 AM Drive Service | Apps Script | Google for Developers

dEditors(emailAddresses) File Ad
apps-script/reference/drive/file#addEditors(String)) (/apps-script/reference/drive/file) us
fo
(/
sc
.

dViewer(emailAddress) File Ad
apps-script/reference/drive/file#addViewer(String)) (/apps-script/reference/drive/file) lis
Fi
(/
sc
.

dViewer(user) File Ad
apps-script/reference/drive/file#addViewer(User)) (/apps-script/reference/drive/file) lis
Fi
(/
sc
.

dViewers(emailAddresses) File Ad
apps-script/reference/drive/file#addViewers(String)) (/apps-script/reference/drive/file) us
fo
(/
sc
.

tAccess(email) Permission Ge
apps-script/reference/drive/file#getAccess(String)) (/apps- gr
script/reference/drive/permission)

tAccess(user) Permission Ge
apps-script/reference/drive/file#getAccess(User)) (/apps- gr
script/reference/drive/permission)

tAs(contentType) Blob Re
apps-script/reference/drive/file#getAs(String)) (https://developers.google.com/apps-ob
script/reference/base/blob.html) to
typ

tBlob()
(/apps-script/reference/drive/file#getBlob()) Blob Re
(https://developers.google.com/apps-ob
script/reference/base/blob.html)

tDateCreated() Date Ge
apps-script/reference/drive/file#getDateCreated()) (/
sc
wa

https://developers.google.com/apps-script/reference/drive 7/23
6/27/25, 10:10 AM Drive Service | Apps Script | Google for Developers

tDescription() String Ge
apps-script/reference/drive/file#getDescription()) th
(/
sc
.

tDownloadUrl() String Ge
apps-script/reference/drive/file#getDownloadUrl()) us

tEditors()
(/apps-script/reference/drive/file#getEditors()) User[] Ge
(/apps-script/reference/drive/user) th
(/
sc
.

tId()
(/apps-script/reference/drive/file#getId()) String Ge
(/
sc
.

tLastUpdated() Date Ge
apps-script/reference/drive/file#getLastUpdated()) (/
sc
wa

tMimeType()
(/apps-script/reference/drive/file#getMimeType()) String Ge
file

tName()
(/apps-script/reference/drive/file#getName()) String Ge
Fi
(/
sc
.

tOwner()
(/apps-script/reference/drive/file#getOwner()) User Ge
(/apps-script/reference/drive/user)

tParents()
(/apps-script/reference/drive/file#getParents()) FolderIterator Ge
(/apps-script/reference/drive/folder- fo
iterator) pa
(/
sc
.

tResourceKey() String Ge
apps-script/reference/drive/file#getResourceKey()) th
(/
sc
th

https://developers.google.com/apps-script/reference/drive 8/23
6/27/25, 10:10 AM Drive Service | Apps Script | Google for Developers

ite
sh

tSecurityUpdateEligible() Boolean Ge
apps-script/reference/drive/file#getSecurityUpdateEligible()) (/
sc
is
se
re
ac
us

tSecurityUpdateEnabled() Boolean Ge
apps-script/reference/drive/file#getSecurityUpdateEnabled()) (/
sc
re
ac
us

tSharingAccess() Access Ge
apps-script/reference/drive/file#getSharingAccess()) (/apps-script/reference/drive/access) ca
(/
sc
,b
us
ex

tSharingPermission() Permission Ge
apps-script/reference/drive/file#getSharingPermission()) (/apps- gr
script/reference/drive/permission) wh
(/
sc
,b
us
ex

tSize()
(/apps-script/reference/drive/file#getSize()) Integer Ge
us
(/
sc
in

tTargetId()
(/apps-script/reference/drive/file#getTargetId()) String If t
ret
it p

tTargetMimeType() String If t
apps-script/reference/drive/file#getTargetMimeType()) ret
th

https://developers.google.com/apps-script/reference/drive 9/23
6/27/25, 10:10 AM Drive Service | Apps Script | Google for Developers

tTargetResourceKey() String If t
apps-script/reference/drive/file#getTargetResourceKey()) ret
of

tThumbnail() Blob Ge
apps-script/reference/drive/file#getThumbnail()) (https://developers.google.com/apps-fo
script/reference/base/blob.html) th

tUrl()
(/apps-script/reference/drive/file#getUrl()) String Ge
us
(/
sc
in
or

tViewers()
(/apps-script/reference/drive/file#getViewers()) User[] Ge
(/apps-script/reference/drive/user) an
Fi
(/
sc
.

ShareableByEditors() Boolean De
apps-script/reference/drive/file#isShareableByEditors()) wi
th
(/
sc
ar
ot
pe

Starred()
(/apps-script/reference/drive/file#isStarred()) Boolean De
Fi
(/
sc
ha
us

Trashed()
(/apps-script/reference/drive/file#isTrashed()) Boolean De
Fi
(/
sc
is
Dr

keCopy()
(/apps-script/reference/drive/file#makeCopy()) File Cr
(/apps-script/reference/drive/file)

https://developers.google.com/apps-script/reference/drive 10/23
6/27/25, 10:10 AM Drive Service | Apps Script | Google for Developers

keCopy(destination) File Cr
apps-script/reference/drive/file#makeCopy(Folder)) (/apps-script/reference/drive/file) in
dir

keCopy(name) File Cr
apps-script/reference/drive/file#makeCopy(String)) (/apps-script/reference/drive/file) an
na

keCopy(name, destination) File Cr


apps-script/reference/drive/file#makeCopy(String,Folder)) (/apps-script/reference/drive/file) in
dir
wi

veTo(destination) File M
apps-script/reference/drive/file#moveTo(Folder)) (/apps-script/reference/drive/file) pr
fo

moveCommenter(emailAddress) File Re
apps-script/reference/drive/file#removeCommenter(String)) (/apps-script/reference/drive/file) fro
co
(/
sc
.

moveCommenter(user) File Re
apps-script/reference/drive/file#removeCommenter(User)) (/apps-script/reference/drive/file) fro
co
(/
sc
.

moveEditor(emailAddress) File Re
apps-script/reference/drive/file#removeEditor(String)) (/apps-script/reference/drive/file) fro
th
(/
sc
.

moveEditor(user) File Re
apps-script/reference/drive/file#removeEditor(User)) (/apps-script/reference/drive/file) fro
th
(/
sc
.

moveViewer(emailAddress) File Re
apps-script/reference/drive/file#removeViewer(String)) (/apps-script/reference/drive/file) fro
an
Fi

https://developers.google.com/apps-script/reference/drive 11/23
6/27/25, 10:10 AM Drive Service | Apps Script | Google for Developers

(/
sc
.

moveViewer(user) File Re
apps-script/reference/drive/file#removeViewer(User)) (/apps-script/reference/drive/file) fro
an
Fi
(/
sc
.

vokePermissions(emailAddress) File Re
apps-script/reference/drive/file#revokePermissions(String)) (/apps-script/reference/drive/file) Fi
(/
sc
gr

vokePermissions(user) File Re
apps-script/reference/drive/file#revokePermissions(User)) (/apps-script/reference/drive/file) Fi
(/
sc
gr

tContent(content) File Ov
apps-script/reference/drive/file#setContent(String)) (/apps-script/reference/drive/file) th
re

tDescription(description) File Se
apps-script/reference/drive/file#setDescription(String)) (/apps-script/reference/drive/file) th
(/
sc
.

tName(name) File Se
apps-script/reference/drive/file#setName(String)) (/apps-script/reference/drive/file) Fi
(/
sc
.

tOwner(emailAddress) File Ch
apps-script/reference/drive/file#setOwner(String)) (/apps-script/reference/drive/file) Fi
(/
sc
.

tOwner(user) File Ch
apps-script/reference/drive/file#setOwner(User)) (/apps-script/reference/drive/file) Fi

https://developers.google.com/apps-script/reference/drive 12/23
6/27/25, 10:10 AM Drive Service | Apps Script | Google for Developers

(/
sc
.

tSecurityUpdateEnabled(enabled) File Se
apps- (/apps-script/reference/drive/file) (/
script/reference/drive/file#setSecurityUpdateEnabled(Boolean)) sc
re
ac
us

tShareableByEditors(shareable) File Se
apps- (/apps-script/reference/drive/file) ed
script/reference/drive/file#setShareableByEditors(Boolean)) Fi
(/
sc
ar
ot
pe

tSharing(accessType, permissionType) File Se


apps- (/apps-script/reference/drive/file) ca
script/reference/drive/file#setSharing(Access,Permission)) (/
sc
an
th
be
us
ex

tStarred(starred) File Se
apps-script/reference/drive/file#setStarred(Boolean)) (/apps-script/reference/drive/file) (/
sc
is
Dr

tTrashed(trashed) File Se
apps-script/reference/drive/file#setTrashed(Boolean)) (/apps-script/reference/drive/file) (/
sc
is
Dr

FileIterator (/apps-script/reference/drive/file-iterator)

Methods

https://developers.google.com/apps-script/reference/drive 13/23
6/27/25, 10:10 AM Drive Service | Apps Script | Google for Developers

Method Return type Brief description

tContinuationToken() String Gets a token that can be used to


apps-script/reference/drive/file- resume this iteration at a later time.
iterator#getContinuationToken())

sNext() Boolean Determines whether calling next()


apps-script/reference/drive/file- (/apps-script/reference/drive/file-
iterator#hasNext()) iterator#next())
will return an item.

xt() File Gets the next item in the collection


apps-script/reference/drive/file- (/apps- of files or folders.
iterator#next()) script/reference/drive/file)

Folder (/apps-script/reference/drive/folder)

Methods

Method Return type

dEditor(emailAddress)
(/apps-script/reference/drive/folder#addEditor(String)) Folder
(/apps-
script/reference/

dEditor(user)
(/apps-script/reference/drive/folder#addEditor(User)) Folder
(/apps-
script/reference/

dEditors(emailAddresses)
(/apps-script/reference/drive/folder#addEditors(String)) Folder
(/apps-
script/reference/

dViewer(emailAddress)
(/apps-script/reference/drive/folder#addViewer(String)) Folder
(/apps-
script/reference/

https://developers.google.com/apps-script/reference/drive 14/23
6/27/25, 10:10 AM Drive Service | Apps Script | Google for Developers

dViewer(user)
(/apps-script/reference/drive/folder#addViewer(User)) Folder
(/apps-
script/reference/

dViewers(emailAddresses)
(/apps-script/reference/drive/folder#addViewers(String)) Folder
(/apps-
script/reference/

eateFile(blob)
(/apps-script/reference/drive/folder#createFile(BlobSource)) File
(/apps-script/ref

eateFile(name, content) File


apps-script/reference/drive/folder#createFile(String,String)) (/apps-script/ref

eateFile(name, content, mimeType) File


apps-script/reference/drive/folder#createFile(String,String,String)) (/apps-script/ref

eateFolder(name)
(/apps-script/reference/drive/folder#createFolder(String)) Folder
(/apps-
script/reference/

eateShortcut(targetId)
(/apps-script/reference/drive/folder#createShortcut(String)) File
(/apps-script/ref

eateShortcutForTargetIdAndResourceKey(targetId, targetResource File


Key) (/apps-script/ref
apps-
script/reference/drive/folder#createShortcutForTargetIdAndResourceKey(String,String))

tAccess(email)
(/apps-script/reference/drive/folder#getAccess(String)) Permission
(/apps-
script/reference/

tAccess(user)
(/apps-script/reference/drive/folder#getAccess(User)) Permission
(/apps-
script/reference/

https://developers.google.com/apps-script/reference/drive 15/23
6/27/25, 10:10 AM Drive Service | Apps Script | Google for Developers

tDateCreated()
(/apps-script/reference/drive/folder#getDateCreated()) Date

tDescription()
(/apps-script/reference/drive/folder#getDescription()) String

tEditors()
(/apps-script/reference/drive/folder#getEditors()) User[]
(/apps-
script/reference/

tFiles()
(/apps-script/reference/drive/folder#getFiles()) FileIterator
(/apps-script/ref
iterator)

tFilesByName(name)
(/apps-script/reference/drive/folder#getFilesByName(String)) FileIterator
(/apps-script/ref
iterator)

tFilesByType(mimeType) FileIterator
apps-script/reference/drive/folder#getFilesByType(String)) (/apps-script/ref
iterator)

tFolders()
(/apps-script/reference/drive/folder#getFolders()) FolderIterato
(/apps-
script/reference/
iterator)

tFoldersByName(name) FolderIterato
apps-script/reference/drive/folder#getFoldersByName(String)) (/apps-
script/reference/
iterator)

tId()
(/apps-script/reference/drive/folder#getId()) String

https://developers.google.com/apps-script/reference/drive 16/23
6/27/25, 10:10 AM Drive Service | Apps Script | Google for Developers

tLastUpdated()
(/apps-script/reference/drive/folder#getLastUpdated()) Date

tName()
(/apps-script/reference/drive/folder#getName()) String

tOwner()
(/apps-script/reference/drive/folder#getOwner()) User
(/apps-
script/reference/

tParents()
(/apps-script/reference/drive/folder#getParents()) FolderIterato
(/apps-
script/reference/
iterator)

tResourceKey()
(/apps-script/reference/drive/folder#getResourceKey()) String

tSecurityUpdateEligible() Boolean
apps-script/reference/drive/folder#getSecurityUpdateEligible())

tSecurityUpdateEnabled() Boolean
apps-script/reference/drive/folder#getSecurityUpdateEnabled())

https://developers.google.com/apps-script/reference/drive 17/23
6/27/25, 10:10 AM Drive Service | Apps Script | Google for Developers

tSharingAccess()
(/apps-script/reference/drive/folder#getSharingAccess()) Access
(/apps-
script/reference/

tSharingPermission()
(/apps-script/reference/drive/folder#getSharingPermission()) Permission
(/apps-
script/reference/

tSize()
(/apps-script/reference/drive/folder#getSize()) Integer

tUrl()
(/apps-script/reference/drive/folder#getUrl()) String

tViewers()
(/apps-script/reference/drive/folder#getViewers()) User[]
(/apps-
script/reference/

ShareableByEditors()
(/apps-script/reference/drive/folder#isShareableByEditors()) Boolean

Starred()
(/apps-script/reference/drive/folder#isStarred()) Boolean

https://developers.google.com/apps-script/reference/drive 18/23
6/27/25, 10:10 AM Drive Service | Apps Script | Google for Developers

Trashed()
(/apps-script/reference/drive/folder#isTrashed()) Boolean

veTo(destination)
(/apps-script/reference/drive/folder#moveTo(Folder)) Folder
(/apps-
script/reference/

moveEditor(emailAddress) Folder
apps-script/reference/drive/folder#removeEditor(String)) (/apps-
script/reference/

moveEditor(user)
(/apps-script/reference/drive/folder#removeEditor(User)) Folder
(/apps-
script/reference/

moveViewer(emailAddress) Folder
apps-script/reference/drive/folder#removeViewer(String)) (/apps-
script/reference/

moveViewer(user)
(/apps-script/reference/drive/folder#removeViewer(User)) Folder
(/apps-
script/reference/

vokePermissions(emailAddress) Folder
apps-script/reference/drive/folder#revokePermissions(String)) (/apps-
script/reference/

https://developers.google.com/apps-script/reference/drive 19/23
6/27/25, 10:10 AM Drive Service | Apps Script | Google for Developers

vokePermissions(user) Folder
apps-script/reference/drive/folder#revokePermissions(User)) (/apps-
script/reference/

archFiles(params)
(/apps-script/reference/drive/folder#searchFiles(String)) FileIterator
(/apps-script/ref
iterator)

archFolders(params)
(/apps-script/reference/drive/folder#searchFolders(String)) FolderIterato
(/apps-
script/reference/
iterator)

tDescription(description) Folder
apps-script/reference/drive/folder#setDescription(String)) (/apps-
script/reference/

tName(name)
(/apps-script/reference/drive/folder#setName(String)) Folder
(/apps-
script/reference/

tOwner(emailAddress)
(/apps-script/reference/drive/folder#setOwner(String)) Folder
(/apps-
script/reference/

tOwner(user)
(/apps-script/reference/drive/folder#setOwner(User)) Folder
(/apps-
script/reference/

tSecurityUpdateEnabled(enabled) Folder
apps-script/reference/drive/folder#setSecurityUpdateEnabled(Boolean)) (/apps-
script/reference/

https://developers.google.com/apps-script/reference/drive 20/23
6/27/25, 10:10 AM Drive Service | Apps Script | Google for Developers

tShareableByEditors(shareable) Folder
apps-script/reference/drive/folder#setShareableByEditors(Boolean)) (/apps-
script/reference/

tSharing(accessType, permissionType) Folder


apps-script/reference/drive/folder#setSharing(Access,Permission)) (/apps-
script/reference/

tStarred(starred)
(/apps-script/reference/drive/folder#setStarred(Boolean)) Folder
(/apps-
script/reference/

tTrashed(trashed)
(/apps-script/reference/drive/folder#setTrashed(Boolean)) Folder
(/apps-
script/reference/

FolderIterator (/apps-script/reference/drive/folder-iterator)

Methods

Method Return type Brief description

tContinuationToken() String Gets a token that can be used to


apps-script/reference/drive/folder- resume this iteration at a later time.
iterator#getContinuationToken())

sNext() Boolean Determines whether calling


apps-script/reference/drive/folder- next()
iterator#hasNext())

https://developers.google.com/apps-script/reference/drive 21/23
6/27/25, 10:10 AM Drive Service | Apps Script | Google for Developers

(/apps-
script/reference/drive/folder-
iterator#next())
will return an item.

xt() Folder Gets the next item in the collection


apps-script/reference/drive/folder- (/apps- of files or folders.
iterator#next()) script/reference/drive/folder)

Permission (/apps-script/reference/drive/permission)

Properties

Property Type Description

VIEW EnumUsers who can access the file or folder are able only to view it or copy it.

EDIT EnumUsers who can access the file or folder are able to edit it.

COMMENT EnumUsers who can access the file or folder are able only to view it, copy it, or
comment on it.

OWNER EnumThe user owns the file or folder.

ORGANIZER EnumUsers who can organize files and folders within a shared drive.

FILE_ EnumUsers who can edit, trash, and move content within a shared drive.
ORGANIZER

NONE EnumThe user does not have any permissions for the file or folder.

User (/apps-script/reference/drive/user)

Methods

Return
Method Brief description
type

tDomain() String Gets the domain name associated with


apps-script/reference/drive/user#getDomain()) the user's account.

https://developers.google.com/apps-script/reference/drive 22/23
6/27/25, 10:10 AM Drive Service | Apps Script | Google for Developers

tEmail() String Gets the user's email address.


apps-script/reference/drive/user#getEmail())

tName()
(/apps-script/reference/drive/user#getName()) String Gets the user's name.

tPhotoUrl() String Gets the URL for the user's photo.


apps-script/reference/drive/user#getPhotoUrl())

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0
License (https://creativecommons.org/licenses/by/4.0/), and code samples are licensed under the Apache
2.0 License (https://www.apache.org/licenses/LICENSE-2.0). For details, see the Google Developers Site
Policies (https://developers.google.com/site-policies). Java is a registered trademark of Oracle and/or its
affiliates.

Last updated 2025-01-13 UTC.

https://developers.google.com/apps-script/reference/drive 23/23

You might also like