Is there a way to save a manipulated table back into the original Excel file so it can have two sheets? 1. Original 2. Edited
I took an Excel table and removed columns in R; I also filtered out NA values. I am able to save this new table as a new Excel file but I'm trying to save it as a new sheet into the original workbook.
I am currently using the openxlsx
package and the write.xlsx()
function.
Code:
library(dplyr)
library(magrittr)
filtered <- BD_Providers %>%
unique() %>%
select(REF_ERP, UUID) %>%
filter(!is.na(UUID)) %>%
filter(!is.na(REF_ERP))
library(openxlsx)
write.xlsx(filtered, file="Table_RFC_UUID.xlsx", sheetName="RFC_UUID")