Forum Discussion

gaurav-narchal's avatar
5 years ago
Solved

Combining Data From Multiple Worksheets Into one table

Hello,

 

How can i combine data from multiple worksheets of excel file into one table in PowerBi?

 

Sample file is attached - Click Here

 

Thanks

Gaurav

  • gaurav-narchal,

     

    1. After connecting to the spreadsheet, right-click the file name and select Transform Data (don't select each individual sheet):

     

    2. Modify the M code by changing the second argument to "true" (prevents repetition of column headers):

     

    Excel.Workbook(File.Contents("C:\Users\MultiSheetImport.xlsx"), true, true)

     

    3. In the Data column, click the Expand icon (double arrow):

     

     

    4. Uncheck "Use original column name as prefix":

     

     

    Result:

     

     

3 Replies

  • gaurav-narchal,

     

    1. After connecting to the spreadsheet, right-click the file name and select Transform Data (don't select each individual sheet):

     

    2. Modify the M code by changing the second argument to "true" (prevents repetition of column headers):

     

    Excel.Workbook(File.Contents("C:\Users\MultiSheetImport.xlsx"), true, true)

     

    3. In the Data column, click the Expand icon (double arrow):

     

     

    4. Uncheck "Use original column name as prefix":

     

     

    Result:

     

     

  • merryone's avatar
    merryone
    Regular Visitor

    Thank you for this! This solution has really made a difference automating a feed into PBI where the source excel file have identical sheets added.