Hi everyone,
I have a password protected excel file which has two excel sheets in it. I'm trying to read the data from the two sheets in Alteryx. However, using the below R code the first sheet data is displaying in the 1-ouput section of R-tool.
But, the second sheet data is not displaying in the 2-ouput section of R-tool.
It throws an error as shown in the below screenshot.
R-program:
# The set of possible repositories to use
options(repos = c(CRAN = "http://mran.revolutionanalytics.com/snapshot/2015-06-20"))
#Setting the library path
.libPaths("C:/Users/YBTQ/OneDrive - NN/R/win-library/3.6")
message("Using library: ", .libPaths()[1])
#Loading the library
library("excel.link")
#Read the excel file
df <- read.Alteryx("#1", mode="data.frame")
filename <- as.character(df[1],"FullPath"])
excel_pwd <- as.character(df[1],"excel_password"])
#Reading the excel file with the respective sheet names
assy <- xl.read.file(filename,xl.sheet="Assy-2021", password = excel_pwd,
write.res.password=excel_pwd)
pack <- xl.read.file(filename,xl.sheet="Pack-2021", password = excel_pwd,
write.res.password=excel_pwd)
#Setting the sheet data as a data frame and downloading the data in Alteryx
assyOutput <- as.data.frame(assy)
write.Alteryx(assy, 1)
packOutput <- as.data.frame(pack)
write.Alteryx(pack, 2)
The error occurs at last write function for the pack.
Please check and help me with the solution.
Thank you.
Best Regards,
Teja.
Is there a reason you are using assyOutput and packOutput as your dataframe variables but writing assy and pack to Alteryx? Try write.Alteryx(assyOutput,1) and write.Alteryx(packOutput,2) - and try to post full screengrabs...
Can you also test your code in rstudio and see what type your variables are? Perhaps because of content assy was a list/df whereas pack was somethign else.