There are times that you want to read in Microsoft Excel files that have been password protected without going through too many extra hoops. Out-of-the-box the INPUT Tool will not do this - 2019.2 included. But you are in luck there are numerous R & Python packages that can handle this request. Here is one example leveraging the R Tool.
Attached below is the workflow, but if you just want the R code then here you go. (notice that library that needs to be installed)
# install.packages(c("excel.link"))
library("excel.link")
df <- read.Alteryx("#1", mode="data.frame")
filename <- as.character(df[1,"FullPath"])
excel_pwd <- as.character(df[1,"excel_password"])
excel_data <- xl.read.file(filename, password = excel_pwd, write.res.password=excel_pwd)
write.Alteryx(excel_data, 1)
@PeterA do you know the package well?
Is there a way to do the opposite - i.e. write to a password protected excel?
Luke
Great Question. Yes there is a simple way with the same package - just check out the online doc for the library - see https://www.rdocumentation.org/packages/excel.link/versions/0.9.8-1/topics/xl.read.file for more information.
xl.save.file(output, filename, xl.sheet = NULL, password = "alteryx", write.res.password = "alteryx")
Legend @PeterA, thanks! I've had a few questions from users around this so is a really nice and useful solution.
Good question @msmt85. Just gave it a quick test... and I can report that YES... it can handle XLSB files without any problem.
@PeterA, how can I use this to open and output multiple files at once? Thanks!
Can somebody indicate where I can download the "excel.link" library? Thanks.
I'm getting the following error message:
R (1) Error in library("excel.link") : there is no package called 'excel.link'
@cruparelia did you ever find a solution to this issue?
I am having the same error you are having in your screenshot.