cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
keo_kimhak26
New Member

I want to create a flow to read email table in the body and fill data in the email

Hello , I have issue with the flow read the email table content in the body and fill into excel table. I appreciate with your help. 

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
v-bofeng-msft
Community Support
Community Support

Could you tell me:
  • Do you want to identify the table in the body of the email and add the contents of the table to an existing excel file one by one?
  • Is this table in HTML format?
  • Where is this excel file?
I assume the table is embedded in the message body in html format.
Because there is no existing function or action that can directly parse HTML tables, this is a challenge.I'v made a test for your reference:
The first step is to strip the form from the email body and convert it to JSON format.
1\In order to facilitate testing, I used'Create_HTML_table' to directly create an HTML table
2\Extract table content from the text-Compose
substring(body('Create_HTML_table'),indexOf(body('Create_HTML_table'),'<td>'),sub(lastIndexOf(body('Create_HTML_table'),'</tr>'),indexOf(body('Create_HTML_table'),'<tr>')))
3\Remove the HTML tags-Compose2
replace(replace(replace(replace(replace(outputs('Compose'),'<tr>',''),'<th>',''),'<td>',''),'</thead>',''),'<tbody>','')
4\Convert characters to array with'</tr>' as separator-Compose3
split(outputs('Compose_2'),'</tr>')
5\Parse the output of Compose3 using "Parse JSON"
6\Create a custom array type variable ‘MyHtmlTable
 
Reference expression:
  • split(items('Apply_to_each'),'</td>')[0]
  • split(items('Apply_to_each'),'</td>')[1]
  • split(items('Apply_to_each'),'</td>')[2]
The Result

1.JPG

Finally, if you want to write the value in the array to an existing excel file, you can refer to this post:
Best Regards,
Bof

View solution in original post

1 REPLY 1
v-bofeng-msft
Community Support
Community Support

Could you tell me:
  • Do you want to identify the table in the body of the email and add the contents of the table to an existing excel file one by one?
  • Is this table in HTML format?
  • Where is this excel file?
I assume the table is embedded in the message body in html format.
Because there is no existing function or action that can directly parse HTML tables, this is a challenge.I'v made a test for your reference:
The first step is to strip the form from the email body and convert it to JSON format.
1\In order to facilitate testing, I used'Create_HTML_table' to directly create an HTML table
2\Extract table content from the text-Compose
substring(body('Create_HTML_table'),indexOf(body('Create_HTML_table'),'<td>'),sub(lastIndexOf(body('Create_HTML_table'),'</tr>'),indexOf(body('Create_HTML_table'),'<tr>')))
3\Remove the HTML tags-Compose2
replace(replace(replace(replace(replace(outputs('Compose'),'<tr>',''),'<th>',''),'<td>',''),'</thead>',''),'<tbody>','')
4\Convert characters to array with'</tr>' as separator-Compose3
split(outputs('Compose_2'),'</tr>')
5\Parse the output of Compose3 using "Parse JSON"
6\Create a custom array type variable ‘MyHtmlTable
 
Reference expression:
  • split(items('Apply_to_each'),'</td>')[0]
  • split(items('Apply_to_each'),'</td>')[1]
  • split(items('Apply_to_each'),'</td>')[2]
The Result

1.JPG

Finally, if you want to write the value in the array to an existing excel file, you can refer to this post:
Best Regards,
Bof

View solution in original post

Helpful resources

Announcements
Process Advisor

Introducing Process Advisor

Check out the new Process Advisor community forum board!

MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

Users online (64,246)