Replacing string "[table]" with datatable. Assuming it to be created for mail body

Hi Team,

In my project, I am having config file entry variable as below:

"Hello Team,

Please find below table: [table]

Best Regards,
RPA Team"

My table:

I want to add a datatable in place of value “[table]”. But I am getting a NULL value.

Exprts, please help fast : @Anil_G, @AJ_Ask , @Kismet_Tosun

Hi @hacky

Use Create HTML Content activity

Regards,

Why not using clasic config style

Bro but I want to insert a datatable value within the string.

Thats exactly what I am doing. I need help with replacing ‘[table]’ keyword with my actual datatable like I attached on my question post.

Try

String.Join(Environment.NewLine, MyDataTable.AsEnumerable().Select(Function(row) String.Join(“,”, row.ItemArray)))

emailBody = emailBody.Replace(“[table]”, tableString)

I need headers also from my table to be in the list

experts. please help : @postwick , @ jitendra.saroj

Hi @hacky,

You can try to convert your datatable into html string format.

The image contains VB.NET code that generates an HTML table from a DataTable object, including columns as table headers and rows as table data cells. (Captioned by AI)

As Rashmi said, you have to convert the datatable to HTML. There are lots of posts here on how to do this. Then you have just a HTML string and can use Replace to put the HTML string where [table] is, as Kismet mentioned.

Hello Team,

quick update.

in my case, output datatable followed by string manipulation operations worked.

thnks for your inputs.

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