Hi
As per the title, I'm having an issue where I'm trying to convert data from an excel table from a file stored in sharepoint into a CSV file. It's is working, but there is always a blank line at the end of the file;
When I pull this file into another flow to process the data it works fine except for this rogue row, which ultimately causes the flow to have a status of failed.
The end goal of this flow is to populate a journal in D365, so if the file has 10 rows, then the 'apply to each' shows 11. The first 10 all process as expected followed by the failure of this empty 11th row.
I've tried creating the csv file and saving it to sharepoint then pulling that into the flow and also tried avoiding the file creation piece and getting the data from within the flow to process by using compose actions but still get the same issue.
If I open the csv file and select all, copy and paste into a compose statement then delete the blank line the output works as expected.
Here's the failure screen in the processing flow, you can see it's looping through 127 line, but there should only have been 126 - there are no failures other than that empty line, the previous 126 lines are processed and appear in D365 F&O.
Thanks for reading and hopefully someone can point me in the direction of how to solve this conundrum.
Thanks for your quick replies and explaining the requirement very well. Glad to hear that all working well.
Thanks
Amazing!
Thanks. This looks to have solved my headache.
126 records with the expression result as 'true', 1 empty line with 'false', 1 journal created with the expected 126 lines and a flow reporting as 'Test succeeded'.
Thank you very much for you help here.
Thanks for the reply.
Add an IF condition inside your Apply To Each
Follow the below steps:
Change the condition to 'not equal to'
Please your cursor inside the Choose a value on left hand side
click expression and type the following
items('LoopData')?['FromTime')
Click ok
Next place the cursor in next choose a value (right hand side of the condition)
Click expression and type null
click ok
Move all the other action steps (set variable, set variable 2, create record 2) inside the Yes condition.
Thanks
When it gets to the final line
it fails at set variable
My select statement is showing a final line of
}
I also think my Initialize variable was wrong
So I changed that, and also my loop which had a skip in for the headers
The problem is still there with that tidied up
Thanks for your reply. I want to see the mapping of the failed step.
Could you please expand these steps and post again?
Thanks
Thanks for the help.
Ok
At this point we have created the csv file and I'm picking it up with 'get file content'
The split on the select is
I then convert the date to the correct format
Create record creates the header of the journal
and the two set variables are conversions of times such as 07:00:00 to integer
Create record 2 creates the lines
126 records as expected
127th empty line at bottom of the csv
Does that help?
Thanks
Could you please post the set variable mapping you trying to do. I will try to answer it.
Thanks
Hi @abm
I don't know. Yes, in theory this sounds ideal, I just don't know how to do it. If you could point me in the right direction that would be much appreciated.
My experience with Power Automate has been mainly using it to move files from one place to another or sending notifications.
This one has been built through trial and error, google and this forum over the past 3 days so I'm still very much in the learning stage here. 🙂
Thanks
WarrenBelz
146,731
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
66,077
Most Valuable Professional