I am working on a script which extracts Gmail attachments from received email addresses assigned to specific labels and to move the attachments to specific folders in Google Drive now my problem is when I receive an email from the same sender of the same email subject saved in different labels the script disregards to move the attachments to different folders in Google Drive because Google groups emails of the same subject as conversations but when I turn off the conversation view in Gmail the script works. Is there a way around this or a function in Google App Script to turn on and Off conversation view? example:
{ // subject1 >>
"filter": "from:[email protected]", // Email to extract attachments from
"folder": "folder1/Belasting/20000/Berario/", // Folder to send attachments to in Gdrive
"filenameTo": "'%s' ~ yyyy MM dd", // format of renaming files if {RenameFile is set to true}
"Renamefile": false, // Turn renaming of files on and off
"globalFilter": "has:attachment in:label1-coj-berario -in:trash -in:drafts -in:spam", // Labels to fetch attachments from in Gmail
"markUsRead": false,
"newerThan": "1m", // how far back to fetch attachments
"archive": true // Turn achiving on and off
},
{ // subject1
"filter": "from:[email protected]", // Email to extract attachments from
"folder": "folder1/Belasting/20000/Tan", // Folder to send attachments to in Gdrive
"filenameTo": "'%s' ~ yyyy MM dd", // format of renaming files if {RenameFile is set to true}
"Renamefile": false, // Turn renaming of files on and off
"globalFilter": "has:attachment in:label2-coj-berenice-tan -in:trash -in:drafts -in:spam", // Labels to fetch attachments from in Gmail
"markUsRead": false,
"newerThan": "1m", // how far back to fetch attachments
"archive": true // Turn achiving on and off
},
The emai has same subject different labels and folders to be saved in but becaused the emails has the same subject and grouped in conversation view the script extracts the attachments and saves them in the same folder