{"id":1391,"date":"2018-02-14T20:10:31","date_gmt":"2018-02-14T20:10:31","guid":{"rendered":"https:\/\/officedevblogs.wpengine.com\/?p=1391"},"modified":"2018-02-14T20:10:31","modified_gmt":"2018-02-14T20:10:31","slug":"kaizala-message-flow-from-excel","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/kaizala-message-flow-from-excel\/","title":{"rendered":"Flow scenario #4: Kaizala message merge from Excel"},"content":{"rendered":"<p>In this post, I will explore the scenario where you have an Excel file that has the content that needs to be sent in a particular format to a particular subscriber \/ user of a Kaizala public (hub and spoke) group.<\/p>\n<h2>Designing the Flow<\/h2>\n<h3>Broad steps in the flow<\/h3>\n<ol>\n<li>Create an Excel file with a table that has the contents<\/li>\n<li>Define a format that will be used to format the message<\/li>\n<li>Write a flow that would\n<ol>\n<li>Run periodically, querying the Excel file for entries not processed already<\/li>\n<li>Update a column in Excel file to denote row processed<\/li>\n<li>Draft a message using the format string<\/li>\n<li>Send formatted message to the user \/ subscriber<\/li>\n<\/ol>\n<\/li>\n<\/ol>\n<h3>Create the Excel file<\/h3>\n<p>For the demo, I have created a table in Excel file that looks like this<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-1392\" src=\"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2018\/06\/excel-table-before-running.png\" alt=\"Excel table before running\" width=\"466\" height=\"107\" srcset=\"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2018\/06\/excel-table-before-running.png 466w, https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2018\/06\/excel-table-before-running-300x69.png 300w\" sizes=\"(max-width: 466px) 100vw, 466px\" \/><\/p>\n<p>(<em><strong>Note:<\/strong>\u00a0I have kept the mobile numbers same as I wanted to demo different output strings. However, when you provide different numbers, the message would go to the corresponding number<\/em>)<\/p>\n<h3>Define a format<\/h3>\n<p>I have 3 fields that need to be input in the format, so have chosen the below format:<\/p>\n<blockquote><p>Hello {0} {1}, thank you for expressing interest in {2} program.<\/p><\/blockquote>\n<p><em>(<\/em><strong><em>Note:<\/em><\/strong><em>\u00a0I just used {n} type of format \u2013 but you could choose anything you prefer<\/em><em>)<\/em><\/p>\n<h3>Write the flow<\/h3>\n<p>For running the flow periodically, I have chosen a daily frequency in the recurrence connector.<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-1393\" src=\"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2018\/06\/recurrence-daily.png\" alt=\"Screenshot of recurrence\" width=\"606\" height=\"145\" srcset=\"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2018\/06\/recurrence-daily.png 606w, https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2018\/06\/recurrence-daily-300x72.png 300w\" sizes=\"(max-width: 606px) 100vw, 606px\" \/><\/p>\n<p>Defined 4 variables using\u00a0<strong>Initialize Variable<\/strong>\u00a0connector to capture:<\/p>\n<ol>\n<li>format string (FormatString)<\/li>\n<li>format string after the title is filled (FormatStringWithTitle)<\/li>\n<li>format string after title and name are filled (FormatStringWithTitleAndName)<\/li>\n<li>output message that will have the final message (OutputMessage)<\/li>\n<\/ol>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-1394\" src=\"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2018\/06\/variables.png\" alt=\"Screenshot of variables\" width=\"504\" height=\"663\" srcset=\"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2018\/06\/variables.png 504w, https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2018\/06\/variables-228x300.png 228w\" sizes=\"(max-width: 504px) 100vw, 504px\" \/><\/p>\n<p>Fetch the rows from the Excel file by using the \u201cGet Rows\u201d action in Excel Flow connector. I have placed the file in OneDrive\u00a0<em>(you will have to authenticate to the data source you choose).<\/em><\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-1395\" src=\"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2018\/06\/get-rows1.png\" alt=\"screenshot of get rows\" width=\"608\" height=\"177\" srcset=\"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2018\/06\/get-rows1.png 608w, https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2018\/06\/get-rows1-300x87.png 300w\" sizes=\"(max-width: 608px) 100vw, 608px\" \/><\/p>\n<p>Then add an \u201cApply to each\u201d to iterate through the rows and add an if condition to check if the\u00a0<strong>Pending\u00a0<\/strong>column of the row has not been updated (empty).<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-1396\" src=\"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2018\/06\/apply-to-each.png\" alt=\"dialog box of condition pending\" width=\"969\" height=\"269\" srcset=\"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2018\/06\/apply-to-each.png 969w, https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2018\/06\/apply-to-each-300x83.png 300w, https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2018\/06\/apply-to-each-768x213.png 768w\" sizes=\"(max-width: 969px) 100vw, 969px\" \/><\/p>\n<p>Update the\u00a0<strong>Pending\u00a0<\/strong>field under the\u00a0<strong>If yes\u00a0<\/strong>branch to indicate the row has been processed. I have marked the\u00a0<strong>Pending\u00a0<\/strong>field to NO here.<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-1397\" src=\"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2018\/06\/update-row.png\" alt=\"update row dialog box\" width=\"607\" height=\"364\" \/><\/p>\n<p>In order to get the message with the format, I have replaced the {0} with title and then used the resultant string to replace {1} with the name and again use the latest string to replace {2} with the program. Since Flow does not allow to assign back to the same variable after doing a replace, used 3 separate variables.<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-1398\" src=\"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2018\/06\/updating-variables.png\" alt=\"updating variables dialog box\" width=\"1093\" height=\"516\" srcset=\"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2018\/06\/updating-variables.png 1093w, https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2018\/06\/updating-variables-300x142.png 300w, https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2018\/06\/updating-variables-1024x483.png 1024w, https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2018\/06\/updating-variables-768x363.png 768w\" sizes=\"(max-width: 1093px) 100vw, 1093px\" \/><\/p>\n<p>Notice the replace method used, taking the Title as an example:<\/p>\n<blockquote><p>replace(variables(\u2018FormatString\u2019),'{0}\u2019,item()?[\u2018Title\u2019])<\/p><\/blockquote>\n<ul>\n<li>{0} \u2013 placeholder used for Title<\/li>\n<li>item() \u2013 signifies the current Excel row data being processed<\/li>\n<li>item()?[\u2018Title\u2019] would fetch the Title column in the current row<\/li>\n<\/ul>\n<p>Finally, send the formatted text to the corresponding user.<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-1399\" src=\"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2018\/06\/send-message.png\" alt=\"send text message to a group dialog box\" width=\"606\" height=\"209\" srcset=\"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2018\/06\/send-message.png 606w, https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2018\/06\/send-message-300x103.png 300w\" sizes=\"(max-width: 606px) 100vw, 606px\" \/><\/p>\n<h2>Output<\/h2>\n<p>Since I had given the same mobile number for the 3 rows, I got all the formatted messages in the same group.<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-1400\" src=\"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2018\/06\/messages.png\" alt=\"screenshot of messages\" width=\"402\" height=\"452\" srcset=\"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2018\/06\/messages.png 402w, https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2018\/06\/messages-267x300.png 267w\" sizes=\"(max-width: 402px) 100vw, 402px\" \/><\/p>\n<p>Excel sheet after it was updated by Flow.<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-1401\" src=\"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2018\/06\/excel-table-after-running.png\" alt=\"Excel table after running\" width=\"602\" height=\"115\" srcset=\"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2018\/06\/excel-table-after-running.png 602w, https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2018\/06\/excel-table-after-running-300x57.png 300w\" sizes=\"(max-width: 602px) 100vw, 602px\" \/><\/p>\n<p>Hope that was helpful. In case you have any questions \/ need any clarifications, feel free to leave a comment. Since the Flow is big, I have shared the flow\u00a0<a href=\"https:\/\/drive.google.com\/open?id=1KxMkdGZdWXXkWl0qhMT0ueFGGrWC1K5n\">here<\/a>. You could download it and Import it on\u00a0<a href=\"https:\/\/flow.microsoft.com\/\">https:\/\/flow.microsoft.com<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this post, I will explore the scenario where you have an Excel file that has the content that needs to be sent in a particular format to a particular subscriber \/ user of a Kaizala public (hub and spoke) group.<\/p>\n","protected":false},"author":69216,"featured_media":1400,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[11],"tags":[18,87],"class_list":["post-1391","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-office-add-ins","tag-excel","tag-kaizala"],"acf":[],"blog_post_summary":"<p>In this post, I will explore the scenario where you have an Excel file that has the content that needs to be sent in a particular format to a particular subscriber \/ user of a Kaizala public (hub and spoke) group.<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/posts\/1391","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/users\/69216"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/comments?post=1391"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/posts\/1391\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/media\/1400"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/media?parent=1391"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/categories?post=1391"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/tags?post=1391"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}