Extract Tables from Saved Mail[Vbscript][Outlook/*.msg][Datatable].

Hello Guys,

Today we are going to learn about how to extract datatables /tables from outlook mail saved in your local machine (.msg file)

Prerequisite : Microsoft Office, Outlook should be installed on the system.

We are going achieve this using Vbscript.

But Before preceding with development lets learn What is an MSG file?

An MSG file is an email message, contact, appointment, or task created or saved within Microsoft Outlook. It may contain one or more email fields, which includes the date, sender, recipient, subject, and message body, or contact information, appointment details, and one or more task descriptions. MSG files are also compatible with other programs that use Microsoft’s Messaging Applications Programming Interface (MAPI).

What is VBScript?

VBScript (Visual Basic Script) is developed by Microsoft with the intention of developing dynamic web pages. It is client-side scripting language like JavaScript. VBScript is a light version of Microsoft Visual Basic. The syntax of VBScript is very similar to that of Visual Basic. If you want your webpage to be more lively and interactive, then you can incorporate VBScript in your code.

Now that we are familiar with the technologies we are going to work on, Lets kick off with the development.

Don’t worry we are not going to go deep inside the vbscript.

So here is our input, it has a table with 4 columns and 2 rows.

Save it in the local folder.

Next drag Invoke VbScript activity and pass the path of vbscript code written by me.

image

Next Pass two arguments MSGFlePath,OutPutExcelPath

MSGFlePath - Path of the Msg file saved in local.
OutPutExcelPath - Path and file name of output excel.

This is will retrieve us the output as shown in screenshot.

Reference : Microsoft.Office.Interop.Excel Namespace | Microsoft Learn

1 Like

Cool one @Akshay07 !!, but where is the script ?

1 Like

Hey @Akshay07,

Could you please share the script.

Thanks,
Sanjit