Okay :-) that is done (Please read all of mine as it covers several things before doing anything)
Let's see what you wrote.
Great to be here in the community. I have 30 years exp. in tech with the last 12 months in AI specifically. My previous experience is mostly in IT & T MSP delivery.
I have been trying to learn Power Automate and CoPilot and navigating my way through it fairly well to date.
I am working on a small workflow automation project for a client:
- Email Received with .txt file attachment
- .txt file to be Parsed and rows added to Dataverse Table
- Various reports and dashboards to be created from data in Dataverse Table
- There are various rules/exceptions to then be applied to the data to prepare invoices
I am a bit stuck at stage 1/2 Parse the .txt file as the flow I have created using the "Document automation base kit" it seems better suited to pdf/image files.
Can anyone recommend a better way to parse the data and get it into dv table rows?
Answer: When saying text files, we really need to see the format. Is it a CSV, is it a Tab delimited, is it just some random format?
Let me start by saying there are some flaws in what you are doing.
1. When you use the Attachments dynamic value from the trigger in an apply to each
2. Then you have to use Get Attachment using the current iterations attachment id to grab the individual Attachment
3. Then you can save it somewhere or directly grab the content
4. From there you would parse it
So when it comes to parsing you would look at a few things
1. If for instance its a CSV, I would simply grab the Content using get file content (sharepoint or onedrive) assuming you saved it there before you processed it, and then use an Apply to each, splitting the data on the carriage return. Then inside that loop I would split the iteration (column) using a comma to get the individual items into an array, then use my Add Item into Dataverse, where I would use the current item (loop iteration), and the array[0] - array[N-1] to access the values into each of the required columns for dataverse
2. If its another format that is like CSV where you can split the rows, then split the columns its the same
3. If its NOT any of that and you say Text, then I would look at using either custom parsing, again based on
It seems like you have some... I don't want to say weird format, but some format, in which personally I would have (since I cannot see the file I have to do some guessing here), use AI Builder and created a model that is based on the format of the Text File.
Then you can easily use AI Builder to read the data from each file, get the entity values and then save them to Dataverse.
All of this is really dependent on us know the what the format of the file looks like to give you the absolute best answer as its not as simple as saying its text what should I use as the format means a ton in how it gets answered.
I am not sure what's not working exactly but if that is working at all I am surprised as I do not know what content you are retrieving and my eyes are bad lol so I cannot see what action that is from I just barely can read what you called it.
Can you share a copy of the Text (assuming its already the same), even if you dummy up the data?
And if it changes, then I REALLY suggest you use AI builder to train a model against the variations and use that to get the data and update dataverse with it.
Hope the helps and if you can share the data it will truly help.
Cheers
If these suggestions help resolve your issue, Please consider Marking the answer as such and also maybe a like.
Thank you!
Sincerely, Michael Gernaey