Quantcast
Channel: Forum Getting started with SQL Server
Viewing all articles
Browse latest Browse all 7129

Execute read_xlsx function within R script within SQL SSMS

$
0
0

Hey all,

I'm trying to make a switch between doing my ETL locally within R to SQL server (with SSMS). I first want to start executing my R scripts/ETL within SSMS in the following way:

execute sp_exectue_external_script
@langauge = N'R'
@script = N'
path <- "path of the files is listed here"
qvdf <- list.files(path = path, pattern = "*.xlsx", include.dirs = TRUE,full.names = TRUE) %>%
lapply(.,read_excel, sheet=1, col_names = TRUE, col_types = "text") %>% 
lapply(.,slice)
...
OutputDataSet <- finaldata %>% as.data.frame()
'
GO

Everything is going alright, with no errors at all, but there is one problem. When I try to read all the data, the column names have disappeared. This is probably because I read the data with my R code. How should I procede?


Viewing all articles
Browse latest Browse all 7129

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>