I need a script to use with google sheets to save a list of .img urls to specific google drive folder with file naming from another cell.
For Example:
Column A - File URL
/imagefilepath.jpg
Column B - Save as name
image_1
Auto save /imagefilepath.jpg to google drive folder "Test" with "image_1" file name.
Is that possible?
New to scripts.. need some advice/pointers or working script (even better)!
Currently got the following:
/**
* Uploads a new file to the user's Drive.
*/
function uploadFile() {
var imgurl = 'https://www.w3schools.com/w3css/img_lights.jpg';
var image = UrlFetchApp.fetch(imgurl).getBlob();
var filename = setName('test');
var folder = DriveApp.getFoldersByName(folder);
if (folder != null) {
var file = DriveApp.createFile(image);
}
Logger.log('ID: %s, File size (bytes): %s', file.id, file.fileSize);
}
But it saves as url name into the root of google drive and only if I insert the img urls into the script. How do i make it dynamic?
P.s found a few scripts on here but all seem to be outdated/dont work. I have over 2000 urls and different file names.