Extract table from Outlook Mail body to Excel file

Hi, I am trying to extract table data from multiple emails in Outlook and save it into a single Excel file. The steps I have followed are:

  1. Saved the email attachments as .mht files.
  2. Opened the .mht files in a browser (Edge) and used web scraping to extract the table data.
  3. Used the ‘Merge Data Table’ activity to combine all the data tables into a single data table.

However, I want the final data table to exclude headers from all Data table and contain only the data rows. Could you please guide me on how to achieve this effectively

@shyamala_shyamu,

If the table headers are being added to the datatable as rows then you can use Filter Datatable activity to remove those rows where column names are there.

This way clean the data and then write it to excel.

@ashokkarale

Thanks for your reply.I have tried this but it’s not working .Kindly assist me.

@shyamala_shyamu,

Ok. To understand it more clearly, can you show how the datatable currently looks like and how do you want it?

@ashokkarale

The data table look like this,

I want to remove the Extra header rows in the 3,5.

@shyamala_shyamu,

Have you filtered the datatable like this?

@ashokkarale

Yes I tried the same

@ashokkarale

Kindly help me in this.

@shyamala_shyamu,

Try this LINQ in assign activity.

filteredDataTable = yourDataTable.AsEnumerable() _
    .Where(Function(row) Not row(0).ToString().Contains("Part Number")) _
    .CopyToDataTable()

@ashokkarale

Tried this but it’s not working…

also have a look the different packages e.g. offered at Marketplace

@ppr

Thanks for your responce.I will check it.

@ashokkarale

It’s working.Thank you so much for you help.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.