0

First of all I want you to know that I'm not talking about uploading a file from users computer drive.

What Im aiming to do is to be able to allow users to add a file from their Google Drive to a specific folder in my Google Drive. I've searched around (a lot) and I can't find anything similar.

Have you ever seen this window? I could use something like it (it's in spanish but im sure you've seen it before). It allows you to upload a file from your pc or from your Google Drive:

enter image description here

Is it possible to access this pop up windows through Google Apps Script? If not, what are the alternatives?

Community
  • 1
  • 1
maeq
  • 1,073
  • 1
  • 12
  • 23

2 Answers2

1

What you have listed there is google picker. It can be used in apps script.

https://developers.google.com/apps-script/guides/dialogs#file-open_dialogs

The docs for Drive picker can be found at:

https://developers.google.com/picker/docs/

Spencer Easton
  • 5,642
  • 1
  • 16
  • 25
  • In thinking he will have a problem trying to add to a folder owner by another account. I doubt its possible unless the folder is already shared with the user. If the script runs as owner then owner would need to have thw picked file already shared. If script runs as user then rhe folder issue will happen. – Zig Mandel Apr 30 '15 at 18:20
  • She will have to either use client side auth for the picker and run the script as "me" or run the script as the user and manage her own token for uploading to her dive with an Oauth2 library. – Spencer Easton Apr 30 '15 at 19:11
  • Thanks, that Google API Picker is what I need... Not a girl btw – maeq May 01 '15 at 17:11
0

What you can do, is use the Drive Picker API to allow users to chose files from their google drive.

Then once you have the File, you can add it to your folder.

https://developers.google.com/apps-script/reference/drive/folder#addFile(File)

https://developers.google.com/picker/docs/

MayK
  • 1,269
  • 1
  • 10
  • 24