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 Automate / How do I write excel d...
Power Automate
Answered

How do I write excel data with column name(excel read from database)?

(1) ShareShare
ReportReport
Posted on by 6

Hi all. I'm struggling with something, below:

 

Currently: In PAD, I'm reading Excel by using Database(open SQL Connection and Executing SQL statement).

But writing the data to new excel is not writing with the column name.

 

Goal: I would like to write the excel data with column name(Excel read from database)

 

Is this possible? How can I accomplish this?

Any help would be greatly appreciated.

I have the same question (0)
  • Henrik_M Profile Picture
    2,021 Super User 2024 Season 1 on at

    Your SQL DataTable variable has a property built in that contains the headers. When you search for your variable for your Write to Excel input, click the arrow next to the variable name, then choose .ColumnHeadersRow as seen in the image: 

    Henrik_M_0-1660855063098.png

    This is the variable property that you write ABOVE your actual variable data (col 1, row1) and then your actual data goes in col1 row1.

  • Verified answer
    Kaif_Siddique Profile Picture
    2,108 Super User 2024 Season 1 on at

    The simplest way to pull data with header is you just need to change the header in connection staring to "NO" (HDR=NO). Please refer the below flow actions for reference.

     

    Kaif_Siddique_0-1660887162600.png

     

    If you want to perform sql query before excel export then create two connection string

    • 1st Connection String with Header "YES" - complete you sql query executions and close connection.
    • 2nd Connection String with Header "NO" - Execute your sql query as per output and close connection, and export to excel.
  • loydtellis Profile Picture
    6 on at

    Much appreciated for your time and help. This solution is working well.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Vish WR Profile Picture

Vish WR 873

#2
Valantis Profile Picture

Valantis 820

#3
Haque Profile Picture

Haque 505

Last 30 days Overall leaderboard