Add group data acquired by BOT to spreadsheet
Home > Connect > Power Automate > Add group data acquired by BOT to spreadsheet
Creating a flow
Create a flow that sequentially executes the process of writing to a spreadsheet using the list data obtained in the cloud BOT.
Cloud BOT(When BOT execution is completed)
Get the BOT execution result when the BOT execution is completed.
Control(Apply to each)
The following actions are executed sequentially for the number of rows of group data acquired by the trigger.
Google Sheets(insert row)
Insert row data into the spreadsheet.
Setting Cloud BOT
1. Click "Create" from the navigation menu on the left side of the screen and select "Automated Cloudflow".
2. Although a modal window of "Build an automated cloud flow" will be displayed, press the "Skip" button."
3. Search for "Cloud BOT" and click the icon.
4. Select "When the BOT execution is completed" for the trigger.
5. Set the trigger. Click here for setting values.
*Create a connection if it doesn't exist. Click here for information on creating a connection.
Setting control
In order to process the group data sequentially, it is necessary to create an array for the number of columns of the group data. Also, you need to create an INDEX variable to refer to the row during sequential execution. Reference the next row in the array by incrementing the INDEX variable at the end of the sequence.
Create a flow as follows.
- Create an array for the number of columns of group data
- Create an INDEX variable
- Set up sequential execution
- Increment the value of the INDEX variable
Create an array for the number of columns of group data
1. Select "New Step".
2. Search for "variable", click the icon and select "Initialize variable".
3. Specify "Name" and "Type".
In this example, "Name" is "acquired group name", "Type" is "Array", and "Value" is "output value obtained from trigger".
The output value Data1.product ID (text data of the group) obtained from the trigger is split with the delimiter (comma) using the split function to create a string array.
Click here for information about the text format of Cloud BOT.
4. Initialize variable for the number of columns of the target group data that you want to set to the action.
Create an INDEX variable
Create an INDEX variable (array subscript) to specify an element in the array. Add an "Initialize variable" action.
In this example, specify "INDEX" for "Name", "integer" for "Type", and "0" for "Value".
Set up sequential execution
1. Select "New Step".
2. Press the built-in tab and search for "Control". Click the "Apply to each" icon.
3. Specify the variable you formatted earlier to "Select an output from the previous steps".
Increment the value of the INDEX variable
1. Select "Add an Action". Set "Google Sheets" first.
2. Search for "variables" and click the icon. Select "Increment variable".
3. Specify the "name".
Setting Google Sheets
1. Select "Add an Action".
2. Search for "Google Sheets" and click the icon.
3. Select "Insert row".
4. Set the action. Set "File", "Worksheet" and specify "Current item" specified in "Apply to each".
*Create a connection if it doesn't exist.
In this example, variables and INDEX are specified in the variables function.
A flow has been created. Check the operation from "Test" in the upper menu (upper right of the screen). If you can confirm the execution result, the setting is completed.
If you actually check the spreadsheet, it will be written as follows.