Send Email to Unique Vendors After Composing the Body of the Email with the Detail of Information (from the excel file) under each Vendor? One Vendor has multiple Rows (and row numbers are changeable)

Hi team,

I have a process that sends a notification email to email addresses. The notification is sent to each unique vendor via the corresponding email address.

However, we have to write detailed information from the spreadsheet on the body email values under Name1, Document Date, Reference, Amount in Cur, Clearing data, currency, document number for each of the emails

here is body of the email for example for one vendor (3006)-

Please kindly find this notification

Name 1 Document Date Reference Amount in cur. Clearing date Currency Document Number
KioskK 5/15/2023 0000341152 -500 2/2/2024 JOD 2000114641
KioskK 3/2/2023 0000338767 -500 2/2/2025 JOD 2000114640
KioskK 4/5/2023 0000339821 -141.29 9/2/2023 JOD 2000114638
KioskK 10/6/2023 0000345860 -500 2/2/2024 JOD 2000120981
KioskK 2/2/2024 500 2/2/2024 JOD 2500033710
KioskK 12/19/2023 0000348231 -875.49 2/15/2024 JOD 2000121190
KioskK 2/15/2024 875.49 9/15/2024 JOD 2500033832
0 JOD

Thank you,

Mr. S

Screenshot example -

We continue doing this for each unique vendor (for 3008, 3157 and more depending on how many vendors we have - please refer to the attached excel file for reference

Thank you,
Sisay
Final_Results_Test.xlsx (15.5 KB)

Can anyone help layout the workflow depending on the statement provided in the above? @ppr, @Yoichi

Thank you for your help!

Hello @Sisay_Dinku ,

Do you need the email to be in a table format in the body of the email only? If not, you could create the table as excel attachments and send the email as attachments.

If the content needs to go in the body of the email, the best way to do is to use a html email template and set the values as dynamic.

Hi @Maggi_Singaravelan

It needs to be in a table format and in the body of the email. We do not want to do the attachment. I am more interested to see the workflow (starting from reading the spreadsheet and composing email based on the data provided).

Thank you,
Sisay

Hi,

How about the following?

dict = dt.AsEnumerable().GroupBy(Function(r) r("Vendor").ToString()).ToDictionary(Function(g) g.Key,Function(g) g.CopyToDataTable())

Sample (output text file instead of sending email)
Sample20250627-1.zip (15.9 KB)

Regards,

1 Like

Hi @Yoichi - thank you for your help.
This much closer to what I want to accomplish. I have two follow up questions

  1. We’d like the columns to exist - the same way it appears in the screenshot of my first post (I am attaching it again)

2 We do not want to have Vendor and email Columns

See the first question -

@Yoichi

Update - I was able to add the column names on tio and remove the columns that we do not need using the following revised expression.

strMail + vbCrLf + vbCrLf +
String.Join(" ", currentKeyValuePairOfTextAndDataTable.Value.Columns.Cast(Of DataColumn).Where(Function(c, i) i > 0 AndAlso i < currentKeyValuePairOfTextAndDataTable.Value.Columns.Count - 1).Select(Function(c) c.ColumnName)) + vbCrLf +
String.Join(vbCrLf, currentK
However, I still want to see the format structured in the body of the email the same way we see in table. Please let me know your insight!

Thanks,
Sisay

Hi @Yoichi

Your approach had worked mostly- just added minor things like converting the expression to html and everything worked like I expected.

Thank you

1 Like

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