0

I am developing an R shiny app that will generate a sequence of editable charts in an Excel file using the officer package. However, when creating a new .xlsx file using the read_xlsx() function, the file contains a blank first sheet entitled "Feuil1" (apparently the template is in French).

WkBook <- read_xlsx() 
WkBook

xlsx document with 1 sheet(s):
[1] "Feuil1"

After adding other appropriately named worksheets to the destination .xlsx file, is it possible to program the app to delete this extraneous "Feuil1" sheet? Officer has an add_sheet() function but doesn't appear to have a function to remove or rename a sheet.

add_sheet(WkBook, "newChart")

xlsx document with 2 sheet(s):
[1] "Feuil1"  "newChart"
lrclark
  • 81
  • 8
  • 1
    Wasn't aware that `officer` offers any functions to manipulate excel files. However, as you already mentioned it looks like `officer` offers only a limited number of functionalities as of the moment. Therefore I would suggest to have a look at e.g. the `openxlsx` package (https://ycphs.github.io/openxlsx/index.html). – stefan Jul 28 '21 at 21:42
  • Thanks for your perspective. However, the ```openxlsx``` package writes graphical content to Excel via the insertImage function, which only appears to be able to export static images in jpeg, png, or bmp format, according to this documentation: https://www.rdocumentation.org/packages/openxlsx/versions/4.2.4/topics/insertImage – lrclark Aug 13 '21 at 18:23

0 Answers0