You might want to....have a folder on your device and a folder on your google drive in synchronisation
(two way)
(added to FAQ)
(added to FAQ)
Thats great, Thank you very much!
Does this also work for subfolders?
If you want to work with multiple folders you could create these on the device, and with some changes to the google apps script to also create folders on google drive at runtime, and set the folder ID to be used. Then provide a selector in the app for "which" folder you want to work with.
create folder in a folder on google drive
//createFolderInFolder(e.parameter.name,e.parameter.targetID)
function createFolderInFolder(name,targetID) {
var targetFolder = DriveApp.getFolderById(targetID);
var newFolder = targetFolder.createFolder(name);
var output = newFolder.getName() +"|"+ newFolder.getId();
return HtmlService
.createHtmlOutput("<html><body><p>Folder Created<br> " + output + "</p></body><script>window.AppInventor.setWebViewString('" + output + "');</script></html>")
.setTitle('New Folder Created');
}
hi, sorry for asking, with these additions on the script app for multiple folders, what are the additional blocks or changes in block necessary in the ai2?
It has been a while since I worked on this, I am therefore a bit rusty on how it all works!
You would need to modify the blocks for the folder creation on the device, to allow for new additional folders to be created, and to then provide a method for selecting the folder you want to work with. You would also need to modify all the synchronisation blocks to handle the selected folder.
Much the same for the google apps script, providing a method for capturing the folder ID required, and then working with that folder and its files.
Too be honest, probably too much like hard work....just prefix your filenames to identify them as a particular set, and use just one folder
okay thank you for the replyyy
hi, i have simplified the given script a little into a specific target folder
like this, and I've run this script on the code.gs to test and a folder was created only when the name is declared (but its supposed to be a variable) - in the picture I've deleted the declared string format of name. i'm fairly new to apps script so Im not sure the blocks arrangement needed to send the folder name input from AI to be run into the script function. is it web URL or post text? and how what are the blocks that can be used for HTMLservice output in the script as well? thank you
The function I provided was taken from another project which used sub functions and returned output to a webview.
Your output probably wants to be returned as ContentService.createTextOutput("")
To just create a new folder, in a folder, you could add the script you have to the doGet() of the main script as another option - e.g. if func = newFolder {your code here}
thank you! ive tried those and it worked, the folder's name is customizable as well and a folder id is returned to the app