Allow Anyone to Upload Files Directly to my Google Drive - google-apps-script

I would like to allow my students to send me one or more files directly to my google drive via a form where they would just enter their name and choose the file(s) to send (drag and drop would be great). A folder with their name would be created in a specific folder on my drive and a warning email would be sent to me. Do you think this is feasible with google script? Thanks in advance.
An example here but paying ...

I've checked and Google Forms already allows for a File Upload kind of question (with drag and drop too).
It automatically creates a folder in your Google Drive (altough it doesnt create a folder for every student) (example here) and in the spreadsheet that it automatically generates there is a permanent link to that file (example here).
If that's not what you are looking for and you need the 'Folder per student' feature then yes, you can use google apps script to move files in folders quite easily.

Related

Creating a google drive folder on customers account

I am working on an application which requires the automatic creation of a folder on customer's Google Drive accounts as opposed to them creating this themselves.
I will have their permission to do so and won't have access to this folder. Ideally this folder would be encrypted but they could do this afterwards themselves.
Is it possible? And if it, how can I achieve that?
It can be done using the REST API. See the section called Creating a folder.
https://developers.google.com/drive/api/v3/folder

create copy of google file in the same drive directory

I'm looking for a way to create a copy of a given file in the same Google Drive directory using Google Apps Script.
The goal is to iterate through a folder structure looking for files owned by a specific user; when such a file is found [doc, spreadsheet, PDF], create a copy in the same place and delete the original.
The reason for this is that we have files owned by users in other domains and Google currently does not allows the transfer of ownership outside the domain. Using a script like this, could help us solve the problem.
Any ideas?
Thanks,

Prevent deletion of files in Google Drive

I am trying to prevent deletion of all files uploaded to specific folder in Google drive. The idea is several people will be able to upload files to this drive, but they should never be able to delete it.
I thought of putting a Google apps script to achieve this, like letting the script run every x interval and getTrashedFiles and set isTrashed to false. But what if the user is able to delete it from trash too?
Is there a foolproof way?
Or is Google Drive not the right answer at all?
Any other service can help me which is simple for people uploading the files?
TIA
its possible but the way you are doing it isnt practical or tamperproof.
instead write a little apps script webapp that allows uploading files to the given folder where you are owner and only writter.
publish it to run as you with permissions to anyone (or your domain). they will be able to add files and view but not change or remove them (and you will be the owner of all uploaded files).
to support uploading files already in drive (move them to the folder) is also possible but with more code.

Google Apps Script - publish google documents and read urls

I'm new to Google apps script.
I can create a number of documents in Google Drive via a script and add content.
I would also like to publish them via a script and record the published URL. Is this possible?
I can see an old answer from 2012
"Publish to the web" for Document in Google Apps Script?
You can create all your content in a publicly shared folder, then once you have the folder's ID, you can create a straightforward base URL (e.g. https://googledrive.com/host/[folder ID]/) and simply append the newly created file names. I asked a question related to this topic a few days ago.
Conversely, you can set the permissions for each file you create then get the download URL's for them individually using getDownloadUrl().

add prefix to all files and folders in google drive

How can I add a prefix or a suffix to all files/ folders in Google Drive using Google Script. The objective is that whenever a users needs to be deleted to add a suffix to all files and folders and transfer to another user so that the documents of the user can easily be tracked at a later stage.
Regards
The File.setName() method in the Drive Service will do what you want. I'd be happy to help further if you post a sample of your code.