Add attachments in specific mails to drive
To add attachments from specific emails to Google Drive, you can use the following steps:
Method 1: Using Gmail's built-in feature
- Log in to your Gmail account and go to the inbox.
- Search for the emails that have the attachments you want to save to Google Drive.
- Check the boxes next to the emails you want to save.
- Click on the "More" menu and select "Forward as attachment".
- In the "Forward as attachment" window, select "Google Drive" as the destination.
- Choose the folder where you want to save the attachments.
- Click "Forward" to save the attachments to Google Drive.
Method 2: Using a third-party add-on
- Install the "Gmail Attachments to Drive" add-on from the Google Workspace Marketplace.
- Go to your Gmail inbox and search for the emails that have the attachments you want to save to Google Drive.
- Check the boxes next to the emails you want to save.
- Click on the "Gmail Attachments to Drive" button that appears in the top right corner of the screen.
- Select the folder where you want to save the attachments.
- Click "Save" to save the attachments to Google Drive.
Method 3: Using a script
- Create a new script in Google Apps Script by going to the Google Drive website, clicking on the "Tools" menu, and selecting "Script editor".
- In the script editor, paste the following code:
function saveAttachments() { var threads = GmailApp.searchThreads("subject:your-subject"); var attachments = []; for (var i = 0; i < threads.length; i++) { var thread = threads[i]; var messages = thread.getMessages(); for (var j = 0; j < messages.length; j++) { var message = messages[j]; var attachmentsInMessage = message.getAttachments(); for (var k = 0; k < attachmentsInMessage.length; k++) { attachments.push(attachmentsInMessage[k]); } } } var folder = DriveApp.getFolderById("your-folder-id"); for (var i = 0; i < attachments.length; i++) { var attachment = attachments[i]; folder.createFile(attachment); } }
- Replace "your-subject" with the subject of the emails you want to save, and "your-folder-id" with the ID of the folder where you want to save the attachments.
- Save the script and give it a name, such as "Save Attachments".
- To run the script, click on the "Run" button or press Ctrl+Enter.
- The script will save the attachments from the specified emails to the specified folder in Google Drive.
Note: Make sure to replace the placeholders with the actual values for your specific use case.