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

Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now

Reply
Anonymous
Not applicable

Connect R Script to Power BI

Hi Community, I am trying to connect an R Script to my Power BI Desktop and I get this error in every attempt: 

tjwebber_0-1619108223920.png

The ADO.NET error I get is "The request is not supported"  which is not the same as -> ADO.NET: Rscript error - Cannot find Dataset 

In the past I have been able to connect an R Script to Power BI under R's 3.5.2 version.  I am currently using R 4.0.3, when that did not work, I went back and installed R 3.5.2, but that also did not work.

I read that specificing the library path in the code would work, but I had no such luck. 
  -  Example code:  library(dyplr, lib.loc = "\\\\example_server/FolderRedirection/my_name/My Documents/R/R-4.0.3/library")  


The only other thing I can think of is Power BI cannot read the path of my working directory.  My script is set up to pull a list of excell files from a folder so it can aggregate them into one dataframe that will be used in Power BI.  Could Power BI be having trouble following the directory path I have set up that brings in my data?  If so, how can I address that?

I would appreciate any help in this matter!  Thanks again.

2 REPLIES 2
v-kkf-msft
Community Support
Community Support

Hi @Anonymous ,

 

I guess it is due to your script error, try the following script:

 

setwd('<Your file path e.g.C:/Users/files>')
library(tidyverse)
library(readxl)
files = list.files("<Your file path e.g.C:/Users/files/>", pattern = "xlsx", full.names = TRUE)
df = map_dfr(files, read_xlsx)    
df

 

image.png

image.png

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.

Best Regards,
Winniz

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

v-kkf-msft
Community Support
Community Support

Hi @Anonymous ,

 

In Power Query you can easily merge multiple excels in a file.

 

image.pngimage.pngimage.png

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.

Best Regards,
Winniz

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
OCT PBI Update Carousel

Power BI Monthly Update - October 2024

Check out the October 2024 Power BI update to learn about new features.

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

October NL Carousel

Fabric Community Update - October 2024

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