is there a way to automatically download a file "example.com/example.zip" directly to my Google Drive instead of downloading it to my server and uploading it again?
In Drive API there is no method to upload a file directly from a URL, with files.create you still have to upload the media. But if you don't want to use your server, you can go for Apps Script, which gives you access to the Drive API via the Advanced Drive Services, as well as the Built-in Drive service, plus some other services like Url Fetch Service with which you could make a request to download from the URL of the file and capture the blob; then use DriveApp.createFile(blob) to upload to Drive.
The beauty of it, it all happens in the cloud in Apps Script servers. Of course you are subject to Apps Script's and Drive API's quotas and limits.
Quotas for Google Services
Related
I'm just having a site and I don't want to store the user uploaded Files in my server . I want to store it in a cloud server or storage like gdrive or dropbox. Is this possible todo?
You can simply use the Google Drive API for achieving this. Google Drive API is using OAuth 2.0 Authentication. You can find API Endpoints and Authentication methods from below link.
https://developers.google.com/drive/api/v3/manage-uploads
I need to create .NET console app to upload/download files to a user's Google drive.
I tried it using service account authorization. But I am not able to view the uploaded files using web UI. I am able view the list of files uploaded using my console APP. But I would like to know whether User Google Drive and files uploaded using my APP are located in different location.
I have a project on Google App Scripts connected to my drive.
I was able to save and organize my files (from mail) and directories in the drive using the script.
now, I want to save the files to an FTP server and cannot find the References to do so.
how do I access an ftp server, create folders and upload files to them ?
thanks
It seems this is not possible. If you check this Class UrlFetchApp, app script only supports HTTP and HTTPS communication over the internet. A supporthing SO thread seems to confirm this.
The workaround to go from GAS -> FTP is as follows. I've been using this method for a number of years in production.
From apps script, save the file to google drive
Using Zapier, trigger to copy new filesfrom the google drive folder to a DropBox folder
Using Microsoft Flow, trigger to copy new files from the Dropbox folder to an FTP or SFTP location.
You can probably do step 3 in Zapier as well. I use Microsoft Flow because I already had a significant number of automated tasks setup there. For Step, 2, I use Zapier because MS flow does not yet have a built-in trigger available based on a new file being saved to google drive. You would have to make your own custom trigger using the google drive API's.
Suppose I want to write a tool which allows the user to copy a file from Dropbox to Google Drive but I don't want to download the file first to my server and then upload it to the drive. Is there a way where I can insert a file to drive by just providing a URL? I couldn't find anything in the documentation.
No.
Having said that, it isn't necessary to create a file on your server. You can buffer the content in memory.
I suppose you could send the access token to the client via a POST request. You'd have to encrypt it, of course, preferably SSL. Then the client could use the Drive SDK to upload the file directly from itself, completely bypassing your server.
Is there a way to make a Chrome packaged app integrate with Google Drive? Specifically, I'm looking to make an app that will sync user's files to Google Drive, be packaged (not hosted), and not have to rely on a secondary add-on app.
However, when a user opens a file from the Google Drive interface, I can't make Google Drive redirect to my packaged app, can I?
No, this is not possible currently. You need a hosted app to receive the redirect from the Google Drive user interface.
If you don't need to handle a redirect from the Drive user interface, you can create a Google Documents List API application that manages a user's files in their Drive. This can e a non-hosted, packaged app.