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
pankaj1408
New Member

Error while exporting data in csv file using R script in power bi service

Hi ,

When i am trying to export powerb dataset into a csv file using R script(shown below)

filename="D:\\BIR\\bitest3.csv"
#dataset <- data.frame(Id, Name)
# dataset <- unique(dataset)
write.csv(dataset,filename)
 
I am able to generate file when i run power bi desktop but when i try to run the same file using power bi services 
i am getting permission denied error, we have tried give all the permission to this folder, file etc.
We have checked gateway dataconnection setting as well, everything is working fine.
PFB error message from power bi services.
 
Error in file(file, ifelse(append, "a", "w")) : cannot open the connection In addition: Warning message: In file(file, ifelse(append, "a", "w")) : cannot open file 'D:\BIR\bitest3.csv': Permission denied
Please try again later or contact support. If you contact support, please provide these details.
Activity IDd1ed46a2-b6d3-401e-8cf8-b28d8dd9f593
Request ID9bf14fcd-ec9c-500a-f9f7-e85facebf04c
Correlation ID32cea294-6fc1-2b12-9147-e4ebac8b1d0f
TimeSun Jul 14 2019 15:48:26 GMT+0530 (India Standard Time)
Version13.0.9933.305
Cluster URIhttps://wabi-india-central-a-primary-redirect.analysis.windows.net

Thanks
Pankaj

1 ACCEPTED SOLUTION
v-shex-msft
Community Support
Community Support

Hi @pankaj1408 ,

For security/permission reasons, you can't execute r script(power bi service side) to loading external data source or do export/import operations on specific path.

Creating R visuals in the Power BI service

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

4 REPLIES 4
kyin0007
Frequent Visitor

here is my r script, 

# 'dataset' holds the input data for this script
output <- as.data.frame(dataset)

currentDate <- Sys.Date()
csvFileName <- paste("C:/Users/
WIP1_", currentDate, ".csv", sep="")

write.csv(dataset,
file = csvFileName, sep=",",
row.names=F)

kyin0007
Frequent Visitor

i have the same problem even in the desktop version

v-shex-msft
Community Support
Community Support

Hi @pankaj1408 ,

For security/permission reasons, you can't execute r script(power bi service side) to loading external data source or do export/import operations on specific path.

Creating R visuals in the Power BI service

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
Anonymous
Not applicable

@Xiaoxin,

 

In my case I have a dataset created from dataflow and R script to export it to CSV, upload it to SharePoint. This works fine on Power Bi desktop. Are you saying this will not work on Power BI services due to security reasons ?

 

Regards,

Jyoti Pawar

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.

Top Solution Authors
Top Kudoed Authors