Is there a R package for updating cells/ranges in a Excel Spreadsheet? I don't want to overwrite the entire spreadsheet. Just target individual cells/ranges. The reason is that the other cells in the spreadsheet have formula, which I don't want to touch.
Something similar to what GemBox provides for Visual Basic?
Note: We need something that is not dependent on JRE.
I've often used the package XLConnect
, which offers many functions:
library("XLConnect")
ls("package:XLConnect")
# [1] "addImage" "appendNamedRegion"
# [3] "appendWorksheet" "aref"
# [5] "aref2idx" "clearNamedRegion"
# [7] "clearRange" "clearRangeFromReference"
# [9] "clearSheet" "cloneSheet"
# [11] "col2idx" "createCellStyle"
# [13] "createFreezePane" "createName"
# [15] "createSheet" "createSplitPane"
# [17] "cref2idx" "existsName"
# [19] "existsSheet" "extractSheetName"
# [21] "getActiveSheetIndex" "getActiveSheetName"
# [23] "getBoundingBox" "getCellFormula"
# [25] "getCellStyle" "getCellStyleForType"
# [27] "getDefinedNames" "getForceFormulaRecalculation"
# [29] "getLastColumn" "getLastRow"
# [31] "getReferenceCoordinates" "getReferenceCoordinatesForName"
# [33] "getReferenceCoordinatesForTable" "getReferenceFormula"
# [35] "getSheetPos" "getSheets"
# [37] "getTables" "hideSheet"
# [39] "idx2aref" "idx2col"
# [41] "idx2cref" "isSheetHidden"
# [43] "isSheetVeryHidden" "isSheetVisible"
# [45] "loadWorkbook" "mergeCells"
# [47] "mirai" "normalizeDataframe"
# [49] "onErrorCell" "print"
# [51] "readNamedRegion" "readNamedRegionFromFile"
# [53] "readTable" "readWorksheet"
# [55] "readWorksheetFromFile" "removeName"
# [57] "removePane" "removeSheet"
# [59] "renameSheet" "saveWorkbook"
# [61] "setActiveSheet" "setAutoFilter"
# [63] "setBorder" "setCellFormula"
# [65] "setCellStyle" "setCellStyleForType"
# [67] "setColumnWidth" "setDataFormat"
# [69] "setDataFormatForType" "setFillBackgroundColor"
# [71] "setFillForegroundColor" "setFillPattern"
# [73] "setForceFormulaRecalculation" "setHyperlink"
# [75] "setMissingValue" "setRowHeight"
# [77] "setSheetColor" "setSheetPos"
# [79] "setStyleAction" "setStyleNamePrefix"
# [81] "setWrapText" "show"
# [83] "summary" "swissfranc"
# [85] "unhideSheet" "unmergeCells"
# [87] "writeNamedRegion" "writeNamedRegionToFile"
# [89] "writeWorksheet" "writeWorksheetToFile"
# [91] "XLC" "xlcDump"
# [93] "xlcEdit" "xlcFreeMemory"
# [95] "xlcMemoryReport" "xlcRestore"
Running help("XLConnect")
offers an example to get you started and there is more material on the web. Specifically, I think you are looking for the writeWorksheet
-function.