Don't miss your chance to take the Fabric Data Engineer (DP-700) exam on us!
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
rawdata <- list.files(path = "C:/User/Sample/", pattern = "*.csv", full.names = TRUE)%>% lapply(read_csv)%>% bind_rows
Having issue with this script when using R as data source in Power BI. When there are only 2 csv's in the catalogue, script is running fine, however when there are 3 or more csv files, script is stopping and keeps "Evaluating".
I know the workaround is to read all csv's individually, but that is defying the purpose of reading whole folder.
Other solution is to write csv and import do Power BI as data source, but that again is adding an extra step.
Any ideas?
So far my only solutions were to run script in R and then import csv as data source, my other working solution was to use read.csv for each file and then bind_rows
Solved! Go to Solution.
Hi @Kryz82 ,
Please make sure that all files have identical column names, order, and data types first, then update the scripts as below to load the files:
files <- list.files(path = "C:/User/Sample/", pattern = "\\.csv$", full.names = TRUE)
rawdata <- NULL
for (f in files) {
tmp <- read.csv(f, stringsAsFactors = FALSE)
rawdata <- if (is.null(rawdata)) tmp else rbind(rawdata, tmp)
}
Or you can refer the following link to get it:
How can I import multiple csv files into R
Besides that, you can connect to "Folder" connector as an alternative:
How To Load Multiple Files Into Power BI
Import data from a folder with multiple files (Power Query) - Microsoft Support
Import multiple files from multiple folders, and "... - Microsoft Fabric Community
Best Regards
Hi @Kryz82 ,
Please make sure that all files have identical column names, order, and data types first, then update the scripts as below to load the files:
files <- list.files(path = "C:/User/Sample/", pattern = "\\.csv$", full.names = TRUE)
rawdata <- NULL
for (f in files) {
tmp <- read.csv(f, stringsAsFactors = FALSE)
rawdata <- if (is.null(rawdata)) tmp else rbind(rawdata, tmp)
}
Or you can refer the following link to get it:
How can I import multiple csv files into R
Besides that, you can connect to "Folder" connector as an alternative:
How To Load Multiple Files Into Power BI
Import data from a folder with multiple files (Power Query) - Microsoft Support
Import multiple files from multiple folders, and "... - Microsoft Fabric Community
Best Regards
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 48 | |
| 45 | |
| 41 | |
| 19 | |
| 18 |
| User | Count |
|---|---|
| 68 | |
| 68 | |
| 33 | |
| 32 | |
| 31 |