0

I would like to read an .xlsx-File from a password protected ftp-Server into my R.

With getURL I'm able to address the files and get their names, for example "sftp://datasource.eex-group.com/market_data/power/ch/derivatives/xls/2023/PowerFutureHistory_CH_2023.xlsx", but then I don't know how to read/import this xlsx-file into R.

Is it a problem, if the path name has a blank, e.g. "sftp://datasource.eex-group.com/market data/power/ch/derivatives/xls/2023/PowerFutureHistory_CH_2023.xlsx"

r2evans
  • 141,215
  • 6
  • 77
  • 149
MPB_2022
  • 67
  • 4

1 Answers1

0

Thanks for the comments.

I found the answer on Reading information from a password protected site for the password protected part and How to simply download an Excel File directly from the Internet with R for downloading the excel/csv-file.

In combination it works perfectly.

url = "sftp://user:passwd@server:port"

file.server <- paste0(url, path.server, "Excelfile_name_server.xlsx")

file.local <- paste0(path.local, "Excelfile_name_local.xlsx")

download.file(file.server, destfile = file.local, mode = "wb")
MPB_2022
  • 67
  • 4