Skip to content
vukisz edited this page May 28, 2021 · 6 revisions

Create new google spreadsheet and add scripts to it. Create two sheets inside spreadsheet. One called "SettingsAndRunningValues" and another "Trans" Trans sheet blueprint: Script run date Message date From To Cc Subject Size in bytes AttachmentsCount Link to thread FolderId MessageBody_FileId Folder with saved attachments / eml files Message body HTML DupsCleaned

Columns L & M 'Folder with saved attachments / eml files' & 'Message body HTML' has to have two formulas prepared in row 2 =hyperlink("https://drive.google.com/drive/u/0/folders/"&J2, "View Folder") =hyperlink("https://drive.google.com/file/d/"&K2, "View message body HTML")

Example running values

  • SheetTransName Trans
  • labelNameToDoSearchIn aaaLargeEmails
  • assignLabelForArchived aaattachments_archivedtodrive
  • emailSizeInBytesToArchive 1048576
  • saveAsSeparateAttachments TRUE
  • duplicateMessageWithoutAttachments TRUE
  • moveMessageToTrash TRUE
  • donotExecute FALSE
  • saveAsSeparateEmlFiles FALSE
  • logToSpreadsheet TRUE
  • DateTimeFormat yyyy-MM-dd HH:mm:ss
  • TimeZone Europe/Vilnius

Go to gmail and create two labels aaaLargeEmails and aaattachments_archivedtodrive Assign all larger conversations to aaaLargeEmails. For example search for conversations (threads) larger than 15MB: size:15000000

Then on a spreadsheet click GmailToDrive->Run GmailToDrive:

Results from sheets perspective:

Results from google drive, where GMailToDrive spreadsheet is located:

Conversatin (thread) Folder contents:

duplicateMessageWithoutAttachments clones e-mail message in gmail without attachments. And it does not work without Gmail api configuration. It can be added and configured through google cloud plartform: console.cloud.google.com as described in https://developers.google.com/apps-script/guides/services/advanced

Clone this wiki locally