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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Add data to Excel from...
Power Automate
Answered

Add data to Excel from a fixed width text file

(1) ShareShare
ReportReport
Posted on by 195

We have a department that gets information from a 3rd party that sends the data over as a Fixed Width Text file.

We are trying to use Power Automate to take the Rows of data, then break out the data for each row to write back to Excel columns.
The issue we are finding is that the Fixed Width is not always the same and so when we try to add the data to the Excel file, data is either missing, or getting added to the wrong columns.
We've created an Array Variable from the file content:

ShaneMeisnerTH_0-1720545507980.png

We then used a compose to split the Text out for each row using the expression - split(outputs('Compose_2'),' ')

But having a heck of a time, due to the Data not always being in the same spot, to add the data to the Excel file in the correct columns.
I've attached the Test Text file, as well as the Output we get back from the Split expression.

Thanks in advance with any help you can give us.

Categories:
I have the same question (0)
  • ShaneMeisnerTH Profile Picture
    195 on at

    Hoping someone might have a "cleaner" way of doing this.. Below is part of what we have so far( there are a total of 19 composes) that seems to be working.
    If anyone has any ideas on how to simplify this, I'd be glad to hear it..
    We tried to use Parse Json, but it does NOT like fixed width text files, so this is what we cam up with.

    ShaneMeisnerTH_0-1720696539449.png

     

  • Verified answer
    claudiovc Profile Picture
    94 on at

    Hi @ShaneMeisnerTH 

     

    I started from the arrangement of lines of text:

     

    My flow:

    FlujoCompleto.PNG

    My flow detail:

    detalleFlujo1.PNG

     

    detalleFlujo2.PNG

    items('Aplicar_a_cada_uno')
    length(item())
     
     

    detalleFlujo3.PNG

    trim(item())

     

     

    detalleFlujo4.PNG

    item()['valor'][0]
    item()['valor'][1]
    if(equals(length(item()['valor'][2]),1),item()['valor'][3],item()['valor'][2])
     
    My output in a html table
    claudiovc_0-1720724856681.png

     

    I hope it helps you

    Greetings!

     

     

  • ShaneMeisnerTH Profile Picture
    195 on at

    Thank you, this is GREAT!!
    The department gets about 10 different formatted Fixed Width Text files from the 3rd party.
    So this code will work for all and the data we have back can then be added to the Excel file!
    thanks again!!!

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

Forum hierarchy changes are complete!

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

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 223 Super User 2025 Season 2

#2
Expiscornovus Profile Picture

Expiscornovus 205 Most Valuable Professional

#3
harshdeol Profile Picture

harshdeol 167 Moderator

Last 30 days Overall leaderboard