Google Apps Script - Add file from Google Drive - google-apps-script

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:
Is it possible to access this pop up windows through Google Apps Script? If not, what are the alternatives?

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/

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/

Related

Auto-create google docs file when uploading photo to Google Drive

I have a bunch of screenshots (probably in thousands) that I want to run OCR on. I tried different services but Google Drive results are far better. But the process is a little tedious. First I have to upload a photo to Google Drive and then right click the uploaded file and select "Open with -> Google Docs". The resultant doc file contains all the text that was in the screenshot. However, it works for only one file at a time.
So is there a way to tell Google Drive to automatically create the doc file for every photo at the time I upload them.
I know there is Google Drive API that could help in this regard but I have very limited experience with coding and API. I could use a program if available.

Which Google API is Dropbox using to edit docs inside its own application?

I've been doing some research to find out which API dropbox is using to edit docs, sheets, and slides using google doc editors inside its own application. I've looked at Google Docs API, Google Drive API, and Google App Scripts I still don't have a clear answer.
From the looks of it files are uploaded to Dropbox, then can be opened in Google's editors and they are saved back to dropbox after editing. These files don't show in my google drive so I am assuming they are not being saved by Google.
These API are correct. It's your assumption that is wrongful. Dropbox may act as a Drive application and these files are outside of your reach, nevertheless still within your Drive.
Here it's explained: store application-specific data.

Is it possible to add a Google Drive UI or frame into an existing website?

Is it possible to add a Google Drive UI to an existing website? We offer a CRM to many clients and want to be able to have them log into their Google Drive accont and drop/pull fiels from it while on the website we provide.
If this exact question has already been answered, then please direct me to the response.
Thanks
You can use Google Drive Picker to access and upload files from/to Google Drive.
https://developers.google.com/picker/

is it possible to download GMail attachment to local folder?

i want to download attachment from gmail and save it to local folder using google script. i did some research about this and i could't find any solution.
so far, i managed to save gmail's attachment to google drive only.
var attachmentBlob = attachment[0].copyBlob();
var file = DriveApp.createFile(attachmentBlob);
folder.addFile(file);
or, is it possible to create a google script to auto download file from google drive?
need some advice.
As #Sujay already mentioned you cannot download a file to a local folder using Google AppScript because GAS runs server-side.
You have already taken a good step with the code to save the attachment as a file to your Google drive.
To answer your sub-question 'is it possible to create a google script to auto download file from google drive?', you do not need a script to do that, that is what the Google Drive Desktop App (https://www.google.com.ng/drive/download/) does exactly.
It syncs all the files you add to your drive to your local-pc. You can also edit Google Drive preferences to sync select folders only, in your case that might be the drive folder referenced in your folder variable.
GAS runs on the server side, and only has access to Google's internal architecture. To save locally it'll need to create some kind of a blob and trigger a download within your browser. not sure if you can do that.

Google Drive file alternateLink not working for copied files [duplicate]

Starting today I'm getting "Google Drive has encountered an error" when users follow the urls we present to preview documents stored on Google Drive. Files are typically Excel and Word. The same links have worked for months and months.
If I try going to the Google Drive web app select the relevant docs and right click,
"Open With > Google Drive Viewer" I get the same error page.
Has something changed/broken?
Edit: This issue has now been fixed.
This is a bug with the Google Drive Viewer that is affecting all files uploaded through the Drive API. The engineering team has been alerted to the problem.
It looks Google engineers have resolved the issue with the Google Drive Viewer. Files I've upload via the Drive SDK are now correctly showing in the Viewer. Thanks for following up on this, Eric!