I'm trying to create a flow that accomplishes the following:
1) Users e-mail a .xlsx to a monitored e-mail address. They will use a template worksheet that has a data table so the table name will be consistent with every submission.
2) When a new e-mail arrives, if there is an attachment with "Confirmation" in the name, that attachment is copied to a OneDrive for Business Folder.
3) A "when a new file is created" trigger is monitoring for when the file is created in OneDrive and then Get Rows is used to read the file and enter the contents of that attachment to a SharePoint List.
4) After the data from the .xlsx is loaded to the SharePoint list, the file is duplicated in an archive folder and the original is deleted.
The issue is the flow will work very randomly. It keeps get hung on the "When a file is created" step. See the second screenshot below, I deleted the file after it was running for over 45 minutes to capture the error. We're only dealing with 2 records in the spreadsheet - so not a ton of data.
What should I do to avoid the issue it's having getting stuck on "When A File Is Created"?
1) Flow layout:
2) Flow stuck on file creation - it shows an error on apply to each, but that happens when I deleted the file from OneDrive:
Thanks for giving the detailed scenario on your flow. According to your description, I have made the following flow for your reference.
Please just remove the trigger When a file is created from your flow. After the action Create file, add the action Create item directly.
As you mentioned that all the attachments have the same table name, do they have the same column names?
If yes, then in the action Create item, use the following functions to get items:
For Title: item()?['name']
For date: item()?['date']
The items will be created successfully in the SharePoint list.
Please try it on your side and feel free post back if you need more help.
@v-yamao-msft Thank you for the suggestions.
I am receiving the following error when it tries to create the SharePoint List item. Any suggestions?
"message": "To add an item to a document library, use SPFileCollection.Add()\r\nclientRequestId: 26368ef2-88ac-4cdc-b392-a3ce59ecbbc6\r\nserviceRequestId: e02c899e-a097-6000-ee8a-3eaf83c71d38"
Could you share a screenshot of your current flow?
In the action Create item, are you trying to populate value into a library but not a list?
Thank you for posting on the Flow Community Forum! It appears as though @v-yamao-msft would like some more information in order to further assist you properly with your issue. Please share any additional information that was requested in order to decrease the amount of time that it will take for you to be assisted!
Thank you for being an active member of the Flow Community!
Flow Community Manager