function downloadAllGmailPictures() {
// Get all Gmail messages.
var messages = GmailApp.getInboxThreads();
// Create a folder in Google Drive to store the pictures.
var folder = DriveApp.createFolder("Gmail Pictures");
// Iterate over all messages and download any attached pictures.
for (var i = 0; i < messages.length; i++) {
var message = messages[i];
var attachments = message.getAttachments();
for (var j = 0; j < attachments.length; j++) {
var attachment = attachments[j];
// Only download pictures.
if (attachment.getContentType().indexOf("image/") == 0) {
// Save the picture to Google Drive.
var file = folder.createFile(attachment.getName(), attachment.getBytes());
}
}
}
}
I've clarified this on the site now. It’s $5 for each year of images you want to download. For example, you can find and save all your photos from 2004 or 2010 (or any year) for $5.
6 comments
[ 2.1 ms ] story [ 192 ms ] threadEdit : did you just prompt copilot for this code? It's not going to work that way...
Have not tried it yet. Does it need debugging?
With no page or info on how much more that $5 it might cost.