Sorting an Array in Flow using Excel Scripts


In this post we are going to discuss sorting an Array from Power Automate Flow, which can be achieved using some third-party connectors, however, many of them are not supported or not free. Hence, I am going to explain how this can be achieved from Flow using script from share point. In this scenario, I am going to sort String Array however this method can be used to sort all Array’s.


Create an Excel Script

First, we must create a script in SharePoint by following the steps below.


Open SharePoint, select documents from the pane on the left side and click on the new button and select Excel workbook from the options.



This will open a new Excel workbook, from the options on the workbook select Automate



A code editor will open on the right corner where we can add the script.



Add the below code to Sort the Array


















After the code is completed, the file is auto saved.



Use Script in Flow


Now, we can use the above script from the flow to sort the Array. Select the operation run script from Flow, where you want the sorting to be done.



Create a connection reference to the SharePoint site where the script is created from the flow by clicking on the options from the step and selecting ‘new connection reference.'



















Once the connection is created, Select the location as SharePoint site where the script is created, and all the other fields as required.




This way we can sort an array from Flow using Script.



0 views0 comments