community
cancel
Showing results for 
Search instead for 
Did you mean: 

Alteryx designer Discussions

Find answers, ask questions, and share expertise about Alteryx Designer.
Community v19.6

Looks aren't everything... But the latest Community refresh looks darn good!

Learn More

A quick tip for reading in password protected excel files

Alteryx
Alteryx

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.

 

workflow.jpgWorkflow to read in a password protected Excel file.

 

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)

 

 

 

Alteryx
Alteryx

@PeterA do you know the package well?

 

Is there a way to do the opposite - i.e. write to a password protected excel?

 

Luke

Alteryx
Alteryx

@LukeM 

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")

 

Alteryx
Alteryx

Legend @PeterA, thanks! I've had a few questions from users around this so is a really nice and useful solution.

Atom
Seems like an easy and Nice to have solution. @peter Does it work for xlsb files as Well? Thanks.
Alteryx
Alteryx

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!

Labels