Forum Discussion
extract data from text body which has html text
- 1 year ago
Hi Manasi25 ,
I see what you’re running into. Basically, Power Query is only pulling the plain text version of your email body and missing the HTML-formatted table (like the one you highlighted in your screenshot). By default, Power Query’s email connector or even M code will often just grab the text part, not the HTML, which is why you’re not getting the rich table.
What you want is to extract data from the HTML body, specifically the table, and load that into Power Query. Here’s how I’d approach it:
- Make sure you’re actually pulling the HTMLBody property, not just the Body or TextBody. Sometimes the connector or source will give you both, but you might need to switch to the HTMLBody field.
- Once you have the HTML, you can use Power Query’s “From Web” or “From File” to load the HTML as text, then use the “Extract Table Using Examples” feature, or write a bit of M code to parse the table tags (<table>, <tr>, <td>). Power Query can actually parse HTML tables pretty well if you feed it the right part.
- If you still only get text, try exporting the email as an .eml or .msg file, then open it with Power Query and pick out the HTML part.
Basically, you want to get the raw HTML into Power Query, then extract the table. The tricky part is making sure you’re not just stuck with the plain text. If your connector doesn’t support HTMLBody, you might need to save emails out and process them manually.
If my response resolved your query, kindly mark it as the Accepted Solution to assist others. Additionally, I would be grateful for a 'Kudos' if you found my response helpful.
translation and formatting supported by AI
Hi Manasi25 ,
I see what you’re running into. Basically, Power Query is only pulling the plain text version of your email body and missing the HTML-formatted table (like the one you highlighted in your screenshot). By default, Power Query’s email connector or even M code will often just grab the text part, not the HTML, which is why you’re not getting the rich table.
What you want is to extract data from the HTML body, specifically the table, and load that into Power Query. Here’s how I’d approach it:
- Make sure you’re actually pulling the HTMLBody property, not just the Body or TextBody. Sometimes the connector or source will give you both, but you might need to switch to the HTMLBody field.
- Once you have the HTML, you can use Power Query’s “From Web” or “From File” to load the HTML as text, then use the “Extract Table Using Examples” feature, or write a bit of M code to parse the table tags (<table>, <tr>, <td>). Power Query can actually parse HTML tables pretty well if you feed it the right part.
- If you still only get text, try exporting the email as an .eml or .msg file, then open it with Power Query and pick out the HTML part.
Basically, you want to get the raw HTML into Power Query, then extract the table. The tricky part is making sure you’re not just stuck with the plain text. If your connector doesn’t support HTMLBody, you might need to save emails out and process them manually.
If my response resolved your query, kindly mark it as the Accepted Solution to assist others. Additionally, I would be grateful for a 'Kudos' if you found my response helpful.
translation and formatting supported by AI
- Manasi251 year agoHelper II
Thank you, will try it.
- v-aatheeque1 year agoCommunity Support
Hi Manasi25
Thank you for your response! I'm glad to hear you're planning to try the suggestions provided. Did it work for you? If so, please consider marking the solution as accepted, as it may help other community members facing similar challenges.If you have any further questions or need additional assistance, don’t hesitate to reach out. We’re here to support you!
Best regards,
Atheeq.