1

I want to import a password protected Excel file with R on Linux. There exists already a solution with the excel.link package:
How do you read a password protected excel file into r?
However, in my case it's not possible, because this package is only available for Windows users. I can't find a package that offers me an import function with a password option.
Can someone help me?

# Here is an example excel document:

path <- "https://github.com/miraisolutions/xlconnect/files/794219/TestWorkbook.xlsx"

password <- "pass"
TobKel
  • 1,293
  • 8
  • 20
  • Here is an answer that works in Linux too: https://stackoverflow.com/a/43915133/2886003 – llrs Mar 10 '23 at 10:29

1 Answers1

0

The R package XLConnect works on Linux. Hence, you should be able to open your Excel file with the following code :

library(XLConnect)

download.file(url = "https://github.com/miraisolutions/xlconnect/files/794219/TestWorkbook.xlsx",
              destfile = "D:/TestWorkbook.xlsx", mode = "wb")

wb <- loadWorkbook(filename = "D:/TestWorkbook.xlsx", create = FALSE, password = "pass")
Emmanuel Hamel
  • 1,769
  • 7
  • 19