1

I've been creating a R Shiny application in which I need to write/modify a sheet from Macro Enabled Excel file (.XLSM) using R. I came up through three packages that deals with this problem: xlsx, openxlsx, XLConnect.

With openxlsx package, I'm able to modify the data from a specific sheet that I want to but meanwhile, all the other sheets present in file lose its entire data. Other packages are not helping me too.

The problem is happening only with .XLSM extension file. When I run same with .XLSX file, everything goes good and smooth.

WB <- loadWorkbook("Abc.xlsm")
writeData(WB, sheet = "Sheet1", dataToPaste, colNames = F)
saveWorkbook(WB,"Abc.xlsm",overwrite = T)
Shashi Bharti
  • 53
  • 2
  • 6
  • Welcome to SO, please try providing a [reproducible example](https://stackoverflow.com/help/minimal-reproducible-example). Without understanding the nitty-gritty bits of your problem I wold suggest a workaround: create a macro in the xlsm file that updates said xlsm with a simple txt file and use shiny to export the data to the txt file and call the macro ([eg](https://stackoverflow.com/questions/19404270/run-vba-script-from-r)). – user5029763 Jan 11 '20 at 01:48

0 Answers0