Skip to main content

convertToGoogle


id: convertToGoogle title: Convert to Google description: Convert MS Office attachments into Google formats.​

This example shows how to convert MS Office attachments into Google formats.

Use the argument toMimeType of the action attachment.store to convert the document into one of the supported formats.

👉 Edit this example in the playground.

{
"description": "Convert MS Office attachments into Google formats.",
"settings": {
"logSheetLocation": "/GmailProcessor-Tests/logsheet-{{date.now|formatDate('yyyy-MM')}}",
"markProcessedMethod": "mark-read"
},
"global": {
"thread": {
"match": {
"query": "has:attachment -in:trash -in:drafts -in:spam after:{{date.now|formatDate('yyyy-MM-dd')}} is:unread subject:\"[GmailProcessor-Test] convertToGoogle\"",
"maxMessageCount": -1,
"minMessageCount": 1
}
}
},
"threads": [
{
"match": {
"query": "from:{{user.email}} to:{{user.email}}"
},
"attachments": [
{
"description": "Process *.docx attachment files",
"match": {
"name": "(?<basename>.+)\\.docx$"
},
"actions": [
{
"description": "Store original docx file",
"name": "attachment.store",
"args": {
"conflictStrategy": "replace",
"location": "/GmailProcessor-Tests/e2e/{{date.now|formatDate('yyyy-MM-dd')}}/features/convertToGoogle/{{attachment.name}}"
}
},
{
"description": "Store docx file converted to Google Docs format",
"name": "attachment.store",
"args": {
"conflictStrategy": "replace",
"location": "/GmailProcessor-Tests/e2e/{{date.now|formatDate('yyyy-MM-dd')}}/features/convertToGoogle/{{attachment.name.match.basename}}-from-docx",
"toMimeType": "application/vnd.google-apps.document"
}
}
]
},
{
"description": "Process *.pptx attachment files",
"match": {
"name": "(?<basename>.+)\\.pptx$"
},
"actions": [
{
"description": "Store original pptx file",
"name": "attachment.store",
"args": {
"conflictStrategy": "replace",
"location": "/GmailProcessor-Tests/e2e/{{date.now|formatDate('yyyy-MM-dd')}}/features/convertToGoogle/{{attachment.name}}"
}
},
{
"description": "Store pptx file converted to Google Presentations format",
"name": "attachment.store",
"args": {
"conflictStrategy": "replace",
"location": "/GmailProcessor-Tests/e2e/{{date.now|formatDate('yyyy-MM-dd')}}/features/convertToGoogle/{{attachment.name.match.basename}}-from-pptx",
"toMimeType": "application/vnd.google-apps.presentation"
}
}
]
},
{
"description": "Process *.xlsx attachment files",
"match": {
"name": "(?<basename>.+)\\.xlsx$"
},
"actions": [
{
"description": "Store original xlsx file",
"name": "attachment.store",
"args": {
"conflictStrategy": "replace",
"location": "/GmailProcessor-Tests/e2e/{{date.now|formatDate('yyyy-MM-dd')}}/features/convertToGoogle/{{attachment.name}}"
}
},
{
"description": "Store xlsx file converted to Google Spreadsheet format",
"name": "attachment.store",
"args": {
"conflictStrategy": "replace",
"location": "/GmailProcessor-Tests/e2e/{{date.now|formatDate('yyyy-MM-dd')}}/features/convertToGoogle/{{attachment.name.match.basename}}-from-xlsx",
"toMimeType": "application/vnd.google-apps.spreadsheet"
}
}
]
}
]
}
]
}

Source: convertToGoogle.ts | PRs: #197