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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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