Manipulate an excel workbook

I know you can read and write excel using readxls and other R packages but is it possible to open a workbook, copy an existing sheet and paste it as a new worksheet in a workbook but in a set position ?

also can you rename a worksheet and modify cells using paste values ?


Yes to all questions I believe.

Have a look at the packages readxl & writexl. See Reading and Writing Excel Files With R Using readxl and writexl

or for more heavy lifting you may want to have a look at the xlsx package. There are several other packages that should do what you want.

openxlsx is also a good package for this. You can load an existing work book, manipulate things (including renaming a sheet), and then save it.

XLConnect is similar but has a Java dependency which can be a pain.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.