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.
I can’t be sure this is causing the issue but you convert the two objects to data frames but then use the non-data frame object in your write statement.
Write.alteryx(assyOutput,1)
Write.alteryx(packOutput,2)
Hi @BenMoss
Thank you for your quick response.
I tried your suggestion but, again the same issue (R (19) Caught an Error in WriteYXDBStreaming() and Unknown field type: Unknown) at the second write function for the pack.
write.Alteryx(packOutput, 2)
If I comment the above function with '#' then there is no error. The error displays when I uncomment this function.
Kindly check the code and help me with the solution.
Thank you.
Teja.