Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
jts_
Helper I
Helper I

Invoke Custom Function: Similar set of columns but different format of headers

Hi! I'd like to have some help on the invoke custom functions in Power Query.

 

I have several (approximately 40) Excel sheets downloaded from the system for clients' order data. Each file represents each client's order records during the selected date range. One of the drawbacks is that, when exported, it does not include any useful information, for example, customer name, in the file name. Instead, it simply shows as "Exported_YYYYMMDD" for every exported file.

 

I'd like to put all these files into a folder and create the Invoke Custom Function in Power Query and process them in bulk. Even though each file contains the same set/ sequence of columns, their header is slightly different from one to another BUT I need the information from the header to be part of data processing.

 

example_.jpg

 

As the example picture shows, I am not able to get the customer name from the file name when exported. I will need to capture it from the header of  "Cus_Name". But each file has a different amount of header before the main table. I am looking for any creative ideas to work around this issue. I appreciate your help and insights in advance! Thanks!

1 REPLY 1
Anonymous
Not applicable

Hi @jts_ ,

In Power BI, you can create a custom function to rename multiple tables in bulk using Power Query Editor. However, it is not possible to rename tables based on the column value dynamically. You can refer the following links to create a custom function to rename the tables:

How to use Power Query Custom Functions (exceloffthegrid.com)

Bulk renaming columns in a table using a Power Query Custom Function (theta.co.nz)

powerbi - Power BI: Renaming many tables and columns using the keyboard - Stack Overflow

Best Regards

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.