gdemin / excel.link

Convenient Data Exchange between R and Microsoft Excel
56 stars 16 forks source link

When I use xl.workbook.save() for password protection, the output is blank #33

Open memotext-sherry opened 3 months ago

memotext-sherry commented 3 months ago

Hi, when I try to use xl.workbook.save() for password protection, the output file is blank.

This is what I'm doing

# State workbook path
file_workbook_path = "/home/workbook.xlsx" 

#export password protected workbook 
xl.workbook.save(
  file_workbook_path,
  password = "pass",
)

When I execute the function the output xlsx file is empty. All the data has been removed.

Is this a bug?

gdemin commented 3 months ago

Hi,

Note that excel.link is Windows-only package. The code below works for me:

library(excel.link)

xl.workbook.add()

xl[a1] = 1:3

# State workbook path
file_workbook_path = "c:/Users/demin/Documents/pass_test.xlsx" 

#export password protected workbook 
xl.workbook.save(
  file_workbook_path,
  password = "pass",
)

xl.workbook.close()