Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions solutions/automations/folder-creation/Code.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/**
* Copyright 2022 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

// To learn how to use this script, refer to the video: https://youtu.be/Utl57R7I2Cs

/**
* This function will create a new folder in the defined Shard Drive. You define
* the Shared Drive by adding its ID on line number 28. The parameter `project`
* is passed in from the AppSheet app. Please watch this video tutorial to see
* how to use this script: https://youtu.be/Utl57R7I2Cs.
*/
function createNewFolder(project) {
const folder = Drive.Files.insert(
{
parents: [{ id: 'ADD YOUR SHARED DRIVE FOLDER ID HERE' }],
title: project,
mimeType: "application/vnd.google-apps.folder",
},
null,
{ supportsAllDrives: true }
);

return folder.alternateLink;
}
7 changes: 7 additions & 0 deletions solutions/automations/folder-creation/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Folder creation

This code sample is part of a video tutorial on how to combine AppSheet and Apps Script.

You can watch the video tutorial to find out how to use the sample at https://youtu.be/Utl57R7I2Cs.

See the [Google Apps Script Documentation](https://developers.google.com/apps-script/advanced/drive) for additional information about the advanced Google Drive services.
14 changes: 14 additions & 0 deletions solutions/automations/folder-creation/appscript.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"timeZone": "Europe/Madrid",
"dependencies": {
"enabledAdvancedServices": [
{
"userSymbol": "Drive",
"version": "v2",
"serviceId": "drive"
}
]
},
"exceptionLogging": "STACKDRIVER",
"runtimeVersion": "V8"
}