用于更新现有 Excel 电子表格中的单元格的 R 包

R package for updating cells in an existing Excel Spreadsheet

是否有用于在 Excel 电子表格中更新 cells/ranges 的 R 包?我不想覆盖整个电子表格。仅针对个人 cells/ranges。原因是电子表格中的其他单元格有公式,我不想触及。

类似于 GemBox 为 Visual Basic 提供的内容?

注意:我们需要一些不依赖于 JRE 的东西。

我经常使用包 XLConnect,它提供了很多功能:

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"   

运行 help("XLConnect") 提供了一个帮助您入门的示例 more material on the web. 具体来说,我认为您正在寻找 writeWorksheet 函数。