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

A new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.

Reply
aoliver
Helper III
Helper III

SDK Power Query - Get data with autentification

Hi everyone
I am working with the SDK of Visual Studio for Power Query in M language, and I have doubts in how can I obtain the data, because the excel file is in a personal server that has windows autentication. the query is as follow:

 

shared Calendario = () as table =>
let
headers = [ AuthenticationKind="UsernamePassword", Username="username", Password="password" ], Source = Excel.Workbook(File.Contents("\\"PrivateIP"\c$\Visualizacion\Horarios.xlsx"),null,true)
in
#"Source";

When I try to import the connector .mez in my powerBI file, it trunks loading the info, and never returns nothing (is like 500 rows, is not a size problem)

 

I am doing the query in the correct way?

 

Thanks in advance

 

3 REPLIES 3
v-piga-msft
Resident Rockstar
Resident Rockstar

Hi @aoliver ,

It seems that your file is not the local file.

I'm afraid that the problem is caused by the File.content.

You could refer to the query below and then modify it based on your scenario.

shared Calendario = () as table =>
let     
    Source = Excel.Workbook(Web.Contents("\\"PrivateIP"\c$\Visualizacion\Horarios.xlsx",headers = [ AuthenticationKind="UsernamePassword", Username="username", Password="password" ]),null,true)
in
#"Source";

In addition, you could have a good look at how to use Web.Contents.
Best Regards,

Cherry

 

Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

I tried that before but powerBI brings this error:

image.png

 

@v-piga-msft 

If it is possible, try to create a little script to load a local file (f.i excel) into the connector, via SDK of visual studio.

 

Cheers

 

aoliver
Helper III
Helper III

any ideas?

Helpful resources

Announcements
May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors