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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Adding headings to a C...
Power Apps
Answered

Adding headings to a CSV file in PowerApps

(0) ShareShare
ReportReport
Posted on by 144

Hi all,

 

My code below works fine when exporting to a CSV. I just need to figure out how to add headings to the columns, would anyone know how ?

ForAll(
 Gallery4_4.AllItems,
 Collect(
 ExportCSVCol,
 {
 TradeNumber: Label34_9.Text,
 FundName: Label35_17.Text,
 TD: Label36_7.Text,
 CCY: Label38_7.Text,
 MarketPrice: Label39_7.Text,
 AMT: Label37_14.Text,
 RevisedAmt: Label37_15.Text,
 Borrowers: Label33_7.Text,
 CounterParties: Label40_7.Text,
 TradeStatus: Label41_9.Text,
 Comments1: Label41_10.Text
 }
 )
);
Set(
 ExportCSVVar,
 Concat(
 ExportCSVCol,
 TradeNumber & "," & FundName & "," & TD & "," & CCY & "," & MarketPrice & "," & AMT & "," & RevisedAmt & "," & Borrowers & "," & CounterParties & "," & TradeStatus & Char(10)
 )
);
Set(
 SuccessVar,
 ExportCSVDemo.Run(
 "CSVTradesFile",
 ExportCSVVar
 ).completed
);
If(
 SuccessVar = "true",
 Launch("https://ofiz-my.sharepoint.com/:x:/g/personal/kiansean_lee_vistra_com/ER5_4KCLBfBFh8qyZo9nv-wB0ou4dCFf01WbvAVivLLO_Q?e=xNyPac&Download=1")
)

 

Thanks,

Conor

Categories:
I have the same question (0)
  • Verified answer
    RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @cnr 

    Please consider changing your Formula to the following:

    With({_ExportCSVVar:
     "TradeNumber,FundName,TD,CCY,MarketPrice,AMT,RevisedAmt,Borrowers,CounterParties,TradeStatus" & Char(10) &
     Concat(Gallery4_4.AllItems, 
     Label34_9.Text & "," & Label35_17.Text & "," & Label36_7.Text & "," & Label38_7.Text & "," & 
     Label39_7.Text & "," & Label37_14.Text & "," & Label37_15.Text & "," & Label33_7.Text & "," & 
     Label40_7.Text & "," & Label41_9.Text & Char(10)
     )
     },
    
     Set(SuccessVar, ExportCSVDemo.Run("CSVTradesFile", _ExportCSVVar).completed)
    );
    
    If(
     SuccessVar = "true",
     Launch("https://ofiz-my.sharepoint.com/:x:/g/personal/kiansean_lee_vistra_com/ER5_4KCLBfBFh8qyZo9nv-wB0ou4dCFf01WbvAVivLLO_Q?e=xNyPac&Download=1")
    )

    There really is no need for a collection to do any of this, so the above does everything in context.

     

    This will add a header to the text being sent to the flow, then followed by the rows from the gallery.

     

    I hope this is helpful for you.

     

     

  • cnr Profile Picture
    144 on at

    Hi @RandyHayes 

    Thanks for coming back to me. It is downloading in CSV but not with the headers you've put in, below what the output on the last run. Could I need a refresh somewhere or is it possible its showing me an old CSV?

     

    cnr_0-1634141543676.png

     

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @cnr 

    Your issue is going to be in how you create that file in the flow you are calling.  You app is now sending the correct data including the header.  So when it gets to your flow, somehow that you are creating the excel file is excluding the header.

    I would look at any previous run of the flow and see what is happening at each step and where the header is being removed/ignored.

     

  • cnr Profile Picture
    144 on at

    Ah yes I see it in there now. Thanks a mill for your help! 

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @cnr 

    Happy to help!

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 364 Most Valuable Professional

#2
11manish Profile Picture

11manish 186

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 105 Super User 2026 Season 1

Last 30 days Overall leaderboard