Insert / Add New row in your sheets using workflow.
This article will help you to create an Insert task using a workflow that will allow you to add a new row in your sheets. For more information on workflows refer what are workflows
Adding form controls
We assume you already have a Micro App created, if not refer here. We will start by adding a new screen with screen type Data Collection and name it as Insert as a screen name.
You can add other controls that you want to insert in Sheets. In this example, we will be using 2 fields Name and Email Id of the User which we will add it in the Sheet.
- We will add a Submit button to the newly created screen - Insert screen. As shown in the above image, For adding a submit button, click on the Controls option on the left side and scroll down to BUTTON section to locate the Submit button as shown below. Click / Drag & drop the Submit button to add it on the Screen.
As shown above, is how our current screen looks like.
- Once the submit button is added, the Workflow icon will get activated. Click on the workflow icon as shown above and Create workflow dialog will open
- Enter your Workflow name and description and click on Create Workflow icon as shown above.
- Click on + icon as shown above and it will open Workflow SELECT TASK Modal.
- Select Update Sheet option, as shown above, Enter the Task Name and you can also add a condition when you want to execute this workflow or keep the condition blank if you want to always execute this workflow. Click on Next .
Select the Sheet Name under WHERE TO UPDATE Dropdown where you want to add the data from the current screen or Create a new Sheet as shown above. In the above example, Task_List is the sheet name where a new record is to be inserted.
Under WHAT TO DO, select Insert Record.
Under INSERT DATA section, it lists all the columns present in the selected sheet (In this case Task_List Sheet) and you can assign value to each individual column. For additional fields that you do not want to enter any values, you can keep it blank.
Values to each column can be assigned in one of the 3 ways by clicking on the F icon as shown above.
1) Static data 2) Sheet 3) Tasks
- Using Static Data - Static data can be any hardcoded value you want to set. For example, you want to set a particular column called status as TRUE() for boolean type value or “Done” for String values or any other functions that can be used. For more details Refer Binding Data in Controls using Static data
- Using Sheet - You can also bind data from any other Sheet using LOOKUP. For more details Refer Binding Data in Controls using Sheets
- Using Tasks - All the controls added in your screen is available under the INITIATED keyword. In the suggestion shown above, it shows the Controls Unique Name added in the given Screen. Unique Name of each control can be viewed by selecting that control added in screen and once highlighted, it is visible under the property section on the right side against Key name - " Unique Name ". For more details on Unique Name, Refer Binding Data in Controls using Controls Reference
- In the above example, Unique Name of " Name " control is : " text5 " and that of Email id control is : " email1 ". We want to add " Name " control’s value into " task_name " column and " Email " control’s value into " assigned_to " column using INITIATED.text5 & INITIATED.email1 respectively as shown in above image.
- Once all values are added as per your need, you can click on Done button .
Testing your workflow
- Now, in order to test this, you will have to Publish this MicroApp. Click on Publish , enter release notes and click on Publish
- Once the App is published, you will have to open the container app and open this MicroApp which will download the MicroApp if not downloaded and will open the same Screen you created with the Submit button. Enter Name and Email Id and click on Submit . It will show successfully submitted and Now, Name and Email Id you added will be added/inserted in your sheet (In this example - it will be added in the sheet named - Task_List )