Essential Functions for Importing Power Automate Forms to SharePoint Lists: A Complete Guide

I personally find Microsoft Forms incredibly convenient, particularly because of its zero UI adjustment requirement.

This is one of its most appealing features.

For interfaces that don’t require extensive input fields, I actually recommend using Forms over Power Apps.

When importing Microsoft Forms responses to SharePoint lists through Power Automate, you’ll need to use specific Power Automate functions. Here’s a comprehensive guide to these essential functions.

スポンサーリンク

Initial Setup: Creating the Forms

Here’s what our sample Forms questionnaire looks like:
Sample Microsoft Forms questionnaire showing different question types
  • Text
  • Text (Integer)
  • Date
  • Text (Floating Point)
  • Options (with ‘Other’)
  • Rating

Initial Setup: SharePoint List

Here’s how our SharePoint list is structured to store the Forms data:
SharePoint list structure showing different column types
  • Single line of text
  • Number (Integer)
  • Date and Time
  • Number (Decimal)
  • Choice
  • Number (Integer)

We’ll be using Power Automate to transfer the Forms responses into this SharePoint list.

Initial Setup: Power Automate

Start from “Automated flow”
Power Automate automated flow creation screen
Select the “When a new response is submitted” trigger for Forms
Forms trigger selection in Power Automate
After selecting your Forms in the trigger, add the “Get response details” action for Forms and input the ID from the “When a new response is submitted” action.
Power Automate response details configuration
Finally, add the SharePoint “Create item” action, and your Power Automate setup is complete!
SharePoint create item action setup in Power Automate

Functions Used in Forms → Power Automate → SharePoint List Integration

All responses from Forms are transferred to Power Automate as text type.
Example of Forms responses in Power Automate showing text format

When storing these text values in SharePoint lists, you need to convert them to the appropriate data type for each column.

Forms “Text” → SharePoint List “Single line of text”

For text-to-text conversion, you can simply add dynamic content without any conversion
Direct text mapping in Power Automate

Forms “Text” → SharePoint List “Number (Integer)”

To convert Forms text input to an integer in SharePoint list, use the int() function.

Select “int” from “Expression” under “Dynamic content”
Selecting int function in Power Automate expressions
Then specify the Forms response you want to convert to integer as the argument for the int() function
Setting up int function with Forms response

Forms “Text” → SharePoint List “Number (Decimal)”

For decimal numbers, use the float() function.

Following the same process, select “float” from “Expression” under “Dynamic content”
Selecting float function in Power Automate expressions
Then specify the Forms response you want to convert to decimal as the argument for the float() function
Setting up float function with Forms response

Forms “Date” → SharePoint List “Date and Time”

To convert a Forms “Date” response to SharePoint list’s “Date and Time” format, use the formatDateTime() function.

Select “formatDateTime” from “Expression” under “Dynamic content”
Selecting formatDateTime function in Power Automate expressions
Then specify the Forms date response you want to convert as the argument for the formatDateTime() function
Setting up formatDateTime function with Forms response

Forms “Choice” → SharePoint List “Choice”

When transferring responses from Forms “Choice” to SharePoint List “Choice” column, you can simply add dynamic content without any conversion, just like with text fields.

Start from “Enter custom value”
Power Automate custom value selection interface
Select the desired value.
Selecting values in Power Automate

Interestingly, when using a choice question with an “Other” option, the flow works perfectly fine even if the response doesn’t match any of the predefined choices in the SharePoint list.

For example, in a choice column with options A, B, O, and AB
SharePoint choice column showing blood type options
Even if someone responds with “Bombay type” in Forms
Forms response showing Bombay type selection
The non-existing choice “Bombay” will be successfully stored in the SharePoint list column
SharePoint list showing Bombay type entry

Forms “Rating” → SharePoint List “Number (Integer)”

Finally, when transferring a Forms “Rating” response to a SharePoint List “Number (Integer)” column, use the int() function, just like we did for “Text to Number” conversion.

Select “int” from “Expression” under “Dynamic content”
Selecting int function for rating conversion in Power Automate
Then specify the Forms rating response you want to convert as the argument for the int() function
Setting up int function with Forms rating response

Multiple Choice Questions

Handling Optional Fields (Blank Values) in Forms

In Microsoft Forms, you can have both “Required” and “Optional” fields. When using optional fields, blank responses may be sent to Power Automate.

For example, if we make all fields optional in our sample Forms and submit without filling any responses, Power Automate receives these blank values:
Power Automate showing blank values from Forms responses
If we directly apply int(), float(), or formatDateTime() functions to these blank values, we’ll get argument errors since these functions cannot process empty values:
Error message showing invalid argument error in Power Automate

To handle this, we need to use the if() function when transferring optional Forms responses to SharePoint list “Number” or “Date and Time” columns.

For example, when converting optional fields to numbers, use this expression:

if(
    empty(outputs('Get response details')?['body/r2cf09ac74d9b4a749b3e0c4d0c9a1ede']), 
    null, 
    int(outputs('Get response details')?['body/r2cf09ac74d9b4a749b3e0c4d0c9a1ede']))
)
For “Date and Time” conversion, simply replace int() with formatDateTime():

if(
    empty(outputs('Get response details')?['body/r2cf09ac74d9b4a749b3e0c4d0c9a1ede']),
    null,
    formatDateTime(outputs('Get response details')?['body/r2cf09ac74d9b4a749b3e0c4d0c9a1ede']))
)

Note: Line breaks added for readability.

Note: The if() function isn’t necessary when transferring optional Forms responses to SharePoint “Single line of text” or “Choice” columns, as these columns can accept blank values.

Here’s how your Power Automate flow should look when all Forms fields are optional:
Complete Power Automate flow setup for optional fields
When executed, it creates a list item with empty values:
SharePoint list showing empty values

If your SharePoint list has required columns, this flow will generate errors. However, you can resolve this by replacing the “null” in the second argument with a default value appropriate for your requirements.

コメント

Copied title and URL