Google-sheets – How to automatically convert all Microsoft Office file attachments in Gmail to Google Docs

gmailgoogle docsgoogle sheetsgoogle-apps-script

My Gmail has thousands of emails. Each email will have several attachments as Microsoft Office files (.doc, .docx, .xls, .xlsx, .ppt, .pptx).

Currently, I want to automatically convert all Microsoft Office file attachments in all my old as well as future emails to Google Document formats and save the converted Google Document file to a separate folder in Google Drive. Then delete the Microsoft Office attachment in the email to reduce storage.

I want to have:
.doc, .docx convert to Google Docs .xls, .xlsx convert to Google Sheets .ppt, .pptx convert to Google Slides.

Is there any way to make the conversion as described above?

Best Answer

The big challenge here, I presume, is to convert .docx to Google doc using apps script. Here is this sub-problem discussed: Can I convert a MS Word document to a Google Document format using GAS?