[TIPS] Get Excel Date Column and Create in SharePoint List Failure


Requirement:  get items from Excel, then create an item in SharePoint list.

Issue:

Got failure when create new item in SharePoint List.


The error occurred in Date column.

The date value in Excel is integer numbers. 

I used a Compose step to get the date value in Flow.

Use the below expression got below error.

if(empty(outputs('Get_Requested_Date')),null, addDays('1899-12-30',int(outputs('Get_Requested_Date')),'yyyy-MM-dd'))

Unable to process template language expressions in action 'Create_item' inputs at line '0' and column '0': 'The template language function 'int' was invoked with a parameter that is not valid. The value cannot be converted to the target type.'.

 

Solution:

Change the expression to below one. The error gone.

if(empty(outputs('Get_Requested_Date')),null, if(isInt(outputs('Get_Requested_Date')), addDays('1899-12-30',int(outputs('Get_Requested_Date')),'yyyy-MM-dd'),null))

If you wanna follow this expression, just replace outputs('Get_Requested_Date') with yours.







No comments:

Post a Comment