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 / Include Header data fr...
Power Automate
Unanswered

Include Header data from SQL Server Connection to Excel

(0) ShareShare
ReportReport
Posted on by 4

I have built an automation that connects to a SQL database, runs a query, launches Excel, writes query results to Excel, closes and saves to a file. This all works except I am not pulling in the header data from the query.  Any ideas?

 

As seen in the image the query has column names. Those column names are not transferring to the excel spreadsheet when it is created.

 

Any help is greatly appreciated. 

 

screenshot.png

Categories:
  • eric-cheng Profile Picture
    5,171 on at

    Hi @admiral70 ,

     

    Can you maybe share some screenshots to help describe the issue you are experiencing?

     

    --------------------------------------------------------------------------
    If I have answered your question, please mark my post as a solution
    If you have found my response helpful, please give it a thumbs up

    Connect on LinkedIn

  • admiral70 Profile Picture
    4 on at

    screenshot.png

     

     

    As seen in the image the query has column names. Those column names are not transferring to the excel spreadsheet when it is created. Appreciate any ideas or solutions. 

     

  • eric-cheng Profile Picture
    5,171 on at

    Hi @admiral70 ,

     

    Running a query in SSMS is a little different.  

     

    In your flow, it will only return the results.  Otherwise your ROWCOUNT will always be 1 even if no results are found.

     

    You can try modifying your query to include a UNION and hardcoding your columns or querying the system tables e.g.

     

    SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'YourTableName' 

     

    --------------------------------------------------------------------------
    If I have answered your question, please mark my post as a solution
    If you have found my response helpful, please give it a thumbs up

    Connect on LinkedIn

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

Leaderboard > Power Automate

#1
Mohsin Ali Profile Picture

Mohsin Ali 414

#2
11manish Profile Picture

11manish 331 Super User 2026 Season 2

#3
M Bilal Khan Profile Picture

M Bilal Khan 274

Last 30 days Overall leaderboard