Skip to main content

Notifications

Power Automate - Building Flows
Suggested answer

Rename Excel Columns

(0) ShareShare
ReportReport
Posted on by

Hello everyone,

Currently, I am working on automating the sending of a report (in my case, a data matrix with filters) for the company where I am doing my internship. The idea is to retrieve this matrix from Power BI, transform it into a CSV file using Power Automate, then convert it into an Excel file, and finally upload it to a folder using Azure Blob Storage.


What I have done so far:

  1. Retrieving the DAX code: I retrieved the DAX code for my matrix from Power BI through View > Performance Analyzer.

  2. Setting up a trigger in Power Automate: I created a trigger in Power Automate to execute the process every Friday at 4 PM.

  3. Running the DAX query: I added a "Run a query against a dataset" action in Power Automate to execute the DAX code. This allowed me to retrieve the data from the Power BI service. Using my credentials, I accessed my workspace and the corresponding report.

  4. Transforming into a CSV file: I used the "Create CSV table" action in Power Automate to transform the data into a CSV file.

  5. Creating an Excel file from a template: 

    • I created a blank Excel file as a template in SharePoint, which I retrieved using the "Get file content using path" action in Power Automate.
    • Then, I added a script found online to transform the CSV file into an Excel file. I inserted this script into the "Automate > New Script" menu of the Excel template.
  6. Creating and modifying the Excel file:

    • I used the "Create file" action in Power Automate to generate an Excel file based on the template, with a name that includes the current date and the template ID.

    • Next, I executed the script using the "Run script" action, specifying the ID of the Excel file and the script to use.
  7. Uploading to Azure Blob Storage: I used the "Get file content using path" action to retrieve the Excel file, and then I uploaded it to an Azure Blob Storage folder using the credentials provided.

 

My current issues

  1. Renaming columns in the Excel file before uploading to Azure Blob Storage: I want to modify the column names in the final Excel file before uploading it to the Blob.
  2. Combining two matrices (from two Power BI reports): We have two CRMs (Angers and Nantes) and therefore two Power BI reports with data matrices. I would like to know if it is possible to retrieve both matrices, combine them vertically (since the columns have the same names), and upload the final merged file to the Blob.

Thank you in advance for your advice and feedback! 😊

  • Suggested answer
    David_MA Profile Picture
    David_MA 8,929 on at
    Rename Excel Columns
    You are almost there with your current approach. There is a YouTube tutorial that will show you how to create a spreadsheet and add columns. You might need to modify what you're doing a little, but using the action to get the file content to retrieve the Excel file is the correct approach. You just need a clean spreadsheet and create the columns each time, which this video will show you how to do: https://youtu.be/RB_ySjhm9Sg?si=Mvu3KchqKyWtvPOU

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

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,445

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,741

Leaderboard