web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Copilot Studio - Autonomous Agents
Answered

Introduction and Help Appreciated

(1) ShareShare
ReportReport
Posted on by 16
Hi All,
 
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?
 
Thank you
I have the same question (0)
  • Verified answer
    Michael E. Gernaey Profile Picture
    52,325 Super User 2025 Season 2 on at
    Introduction and Help Appreciated
     
    We are more than welcome to help but this is not a Power Up question so I am going to move it to the right location first as this is not for general questions, it should be in the Copilot forums, this is for people doing the copilot modules in the power up program.
     
     
  • Verified answer
    Michael E. Gernaey Profile Picture
    52,325 Super User 2025 Season 2 on at
    Introduction and Help Appreciated
    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
  • GH-12112157-0 Profile Picture
    16 on at
    Introduction and Help Appreciated
    Hi Michael,
     
    Thanks for the redirect and the great feedback.
     
    Attached is an example of the file with old data so no privacy issues.
     
    I did start down the AI Builder pathway however switched back to flow in Copilot based on some reading so may have got sidetracked there.
     
    Thanks for taking the time to look at this.
  • GH-12112157-0 Profile Picture
    16 on at
    Introduction and Help Appreciated
    Following on from the original issue I now have the data from the text file parsing into an array of rows (image attached). I am now having some further difficulty in getting valid lines of data into a Dataverse Table. Basically once the data has been slit into lines by a compose action it's passed to an Inner loop - Condition (Exclude invalid lines by header) so if True - Exclude Line or if False - Line is Valid - pass to compose action.
     
    Upon testing I'm not getting any lines pass to the false condition.
     
    I am hoping someone can see where I am going wrong, the expression I am using for the compose action to return a structured object that I can reference in your Add a new row Dataverse action.
     
    Expression:
     
    {
      "ConnoteNumber": split(item(), ' ')[0],
      "ConsignedQty": split(item(), ' ')[1],
      "ManifestedQty": split(item(), ' ')[2],
      "ShortageQty": split(item(), ' ')[3],
      "ScannedLabels": concat(split(item(), ' ')[4], ' ', split(item(), ' ')[5], ' ', split(item(), ' ')[6]),
      "Weight": split(item(), ' ')[7],
      "Date": split(item(), ' ')[8],
      "Time": split(item(), ' ')[9],
      "Receiver": concat(split(item(), ' ')[10], ' ', split(item(), ' ')[11]),
      "Suburb": join(skip(split(item(), ' '), 12), ' '),
      "DriverID": variables('DriverID')
    }
     
    I have attached a sample or the original text file as well as the output from the Split into lines Compose action that asses to the Exclude Line Condition. Also attached is an image of the flow. 
     
    Any assistance or feedback would be greatly appreciated.
  • Michael E. Gernaey Profile Picture
    52,325 Super User 2025 Season 2 on at
    Introduction and Help Appreciated
     
    Can you share what your condition is? I'd like to verify why you are always going to one side.
     
    I know this might sound silly but,  you have a valid line condition check, but I would expect  you to put it in the Yes side not the no side.
     
    if you can share your condition we can help you fix that so it goes to the right spot.
     
    Your expression looks fine, but its your condition that is forcing you to the Yes side each time, so we need to find out why.
  • GH-12112157-0 Profile Picture
    16 on at
    Introduction and Help Appreciated
    Thanks for the fast reply Michael.
     
    Here's the condition.
     
  • GH-12112157-0 Profile Picture
    16 on at
    Introduction and Help Appreciated
    Here's the expression if it's easier:
     
    or(
        contains(item(), 'RUN DATE'),
        contains(item(), 'REPORT NO'),
        contains(item(), 'REQUESTED BY'),
        contains(item(), 'FOR SUPERVISOR'),
        contains(item(), 'DEPOT:'),
        contains(item(), 'SCANNER ID:'),
        contains(item(), '*'),
        contains(item(), 'DATE RANGE:'),
        contains(item(), 'CONNOTE NUMBER'),
        contains(item(), 'SCANNED'),
        contains(item(), 'SHORTAGE'),
        contains(item(), 'LABELS'),
        contains(item(), 'WEIGHT'),
        contains(item(), 'RECEIVER'),
        contains(item(), 'SUBURB'),
        contains(item(), 'PAGE'),
        contains(item(), '--------------------------------------'),
        empty(trim(item()))
    )

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Coming soon: forum hierarchy changes

In our never-ending quest to improve we are simplifying the forum hierarchy…

Chiara Carbone – Community Spotlight

We are honored to recognize Chiara Carbone as our Community Spotlight for November…

Leaderboard > Copilot Studio

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 356 Super User 2025 Season 2

#2
Romain The Low-Code Bearded Bear Profile Picture

Romain The Low-Code... 345 Super User 2025 Season 2

#3
S-Venkadesh Profile Picture

S-Venkadesh 57 Moderator

Last 30 days Overall leaderboard