Part 1 Documentation
01
Go to google drive and go to the folders section

02
Go to the Reference page for files
→ create
https://developers.google.com/drive/api/reference/rest/v3/files

03
We need the uploadType
the others are optional

04
Scroll down to the Request Body in the Overview
section,
https://developers.google.com/drive/api/reference/rest/v3/files#File
we will need to specify
the mimeType
and the name


05
Go → Supported Mime types
Under Version 2 'v2??'
https://developers.google.com/drive/api/guides/mime-types
We will be using the folders mime type to create folders,
application/vnd.google-apps.folder

Part 2 - Create Folders Script
01
Loop through the national_park
list and create the folders
by creating a file_metadata
dictionary that includes the folder name and
mimeType
application/vnd.google-apps.folder
for folder, then add it to the body
parameter in
the create()
method
from googleServiceCreate import create_service CLIENT_SECRET = 'credentials.json' API_NAME = 'drive' API_VERSION = 'v3' SCOPES = ['https://www.googleapis.com/auth/drive'] service = create_service(CLIENT_SECRET,API_NAME,API_VERSION,SCOPES) national_parks = ['Yellowstone','Rocky Moutains','Yosemite'] for national_park in national_parks: file_metadata = { 'name': national_park, 'mimeType': 'application/vnd.google-apps.folder' } service.files().create(body =file_metadata).execute()

02
Now the folders will appear in the google drive
