Home > Back-end >  How to define .xlsm file saved on Sharepoint as a datasource in Power Query M code?
How to define .xlsm file saved on Sharepoint as a datasource in Power Query M code?

Time:07-22

I'm working in Power BI.

I have a data source which is an .xlsm excel file stored in a sharepoint folder which I need to bring into Power BI (I can't Get Data > Sharepoint Folder as it's set up wrong).

I have another which is a .csv file saved in sharepoint, which I am bringing in already.

The source function in the power query m code for the .csv file is:

let Source = Csv.Document(Web.Contents("https://

I need to add another one similar for the .xlsm file. How can change the m code to bring in the .xlsm file?

I thought something like this would work, but it doesn't:

let Source = xlsm.Document(Web.Contents("https://

CodePudding user response:

Try

Source = Excel.Workbook(Web.Contents("https:// ... .xlsm"))

In case the problem is finding the proper workbook URL, open the workbook in Excel, go to File - Info - Copy Path, paste it into Power BI's Get data - From web URL and delete the last 6 characters (?web=1).

  • Related