invitation india
UnexpectedWeb
Connect

Popular Technology Blog where you'll find some interesting things around the web, that you never knew existed.

link Link copied

Directly Save File to Google Drive by URL - Google App Script

Share on: link Link copied

A simple google app script to store or save a PDF file to google drive via URL(link). 

With this Google App Script, you can download PDF file from the web directly to your Google Drive accounts without having to download that file to your computer. 
This is really a great idea if we need to Collect, Store or save multiple PDF files by url, and where the URLs in sequence form like: myFile001.pdf, myFile002.pdf.... myFile895.pdf. And because the script runs on google server so we not need to TurnOn our PC. 

This is the Basic Version of Code:
1.  Create a New Google Spreadsheet. 

2. Go to Tools > Script editor...  
3. Pase Following Code, Save and run.



function SaveToGoogleDrive(){

  var folderID = '1ZoCDCLrKMmUy-ylEgOy59So1VQvzNjYZ';  // put id of the Google Drive folder
  var folder = DriveApp.getFolderById(folderID)// get the folder
  var sheet = SpreadsheetApp.getActiveSheet();
  var data = sheet.getDataRange().getValues();

  for (var i = 1; i < data.length; i++) {
    var pdfURL = data[i][2];
    var myFileName = data[i][1] + '.pdf';
    var file = UrlFetchApp.fetch(pdfURL);
    folder.createFile(file);
    
  }

}
* use folder.createFile(file);  to Save File with Default/Original Name.


Updated Tool


Save to Google Drive

Download any File from the web directly in your Google Drive. You can save any file directly to Google drive using File URL. It's Quick and easy way to Upload file to google Drive without download the file to your computer or device. Click on below button to use Spreadsheet based tool.





Tags: Save Web Files Instantly to your Online Drives, Download Files a Sequential Range of URLs, Directly save file to Google drive by url, automate the download of a list of URLs Files, Batch download numbered sequence File by url, How to Download Multiple Files Easily



2 comments:

  1. Hey Can you Share the Source Code of "Save Drive WebApp" Google Script?

    ReplyDelete
    Replies
    1. source code is the same that i have mentioned in this post

      Delete

Powered by Blogger.