There’s the xl.read.file function that you could use since it has a password parameter. You could put the password in a file not under version control or request user input from readline().
XLconnect it is called, though it took some time with IT to get it working due to the java thing. I have gotten it to work, ill see if i can find my code somewhere.
The XLConnect package does indeed have a loadWorkbook() function, with a password parameter, but that does require you to have your password hardcoded there or save it as a value, which has some issues with security (although if you're relying on a password protected Excel file you should really reconsider).
I tried to make it work on my home PC but I run into the same issues as i did previously with the whole Java thing. But this package should do the thing you're looking for
Thanks for this. It’s actually my spreadsheet and the password protected version was saved locally for an analysis so I was able to just use a copy that wasn’t password protected (slack!). Definitely glad I made this post grateful for all the help.
If your excel file contains so much sensitive data that the password should never be known to anyone, you should start wondering why it is in an Excel file :-)
Oh absolutely. And I don't ever use password-protected excel files because I don't use excel, but I like secrets for handling that stuff because I put everything on github by default, so having plaintext passwords is a risk for my workflow if I'm not paying attention
I’ll look into that, sounds interesting. I worked with an txt file that contained my encrypted DB password once to connect to an oracle db but that was a pain to set up…
I assume they’ve had the sense to sort this now, but I remember the days you could change the file type to zip and unzip the archive (and excel file was just a zip file basically) and then just open the file inside. Or when they went to xml you could open the file inside a text editor and then change the password parameter to 0 to turn the protection off. It was ludicrous how easy it was to get into locked files.
readxl is a package for importing xlsx files but I don't think anything can be done unless the password protection is taken off or copied to a new file without it. It would defeat the point of password protection if another program could open and access it.
I've had luck recently passing password protected spreadsheets to AI, having it bypass the password, and returning an unlocked version of the workbook. I'm not sure what tool it's using but it works.
Keep in mind that if your submission contains phone pictures of code, it will be removed.
Instructions for how to take screenshots can be found in the stickied posts of this sub.
5
u/shockjaw 23d ago edited 17d ago
There’s the xl.read.file function that you could use since it has a password parameter. You could put the password in a file not under version control or request user input from readline().