xlconnect

R Save a excel workbook with password protection

我只是一个虾纸丫 提交于 2019-12-01 09:22:04
I'm a bit impressed because I couldn't find an answer so far. I have a small R script that is loading data from one source and writing a few dozens Excel files from it. The problem now is: those files need a password protection. Currently my script is using the XLConnect library to save the excel files. The script is something like this: # Load data from source source = <connection string to source> dataFromSource = <read from source> # Process for (data in dataFromSource) { wb = loadWorkbook( paste("myWorkbook", sourceName, ".xlsx"), create = TRUE) createSheet(wb, name = "sheet") <put data

XLConnect loadWorkbook error - POIXMLException (Java)

好久不见. 提交于 2019-11-30 23:58:55
I'm trying to load a hefty Excel workbook (.xlsm format, ~30 mb) that has a large number of array calcs. > wb1 <- loadWorkbook("Mar_SP_20130227_V6.1.xlsm") Error: POIXMLException (Java): java.lang.reflect.InvocationTargetException But I am able to successfully load a values-only/no-macro version of the workbook. > wb2 <- loadWorkbook("Mar_SP_20130227_V6.1_VALUES_ONLY.xlsx") > wb2 [1] "Mar_SP_20130227_V6.1_VALUES_ONLY.xlsx" What could be causing the error? From the maintainer's website I can see that there can be issues with workbooks containing array calcs or unsupported formula functions, but

Installing R library XLConnect on OS 10.8.2

∥☆過路亽.° 提交于 2019-11-30 20:05:10
XLConnect is, as the manual describes it, "a package that allows for reading, writing and manipulation of Microsoft Excel files from within R". Installation on Windows and Linux is straightforward. Simply tell R to install.packages("XLConnect") , and you're done. On OS X you need to use install.packages("XLConnect", type="source") , the installation instructions say. Trying this under OS 10.8.2, R output a number of error messages. I post them here, so Google can send people with similar problems to this Q and A. For a solution to the problem, scroll down. R output: > install.packages(

XLConnect loadWorkbook error - POIXMLException (Java)

隐身守侯 提交于 2019-11-30 19:01:03
问题 I'm trying to load a hefty Excel workbook (.xlsm format, ~30 mb) that has a large number of array calcs. > wb1 <- loadWorkbook("Mar_SP_20130227_V6.1.xlsm") Error: POIXMLException (Java): java.lang.reflect.InvocationTargetException But I am able to successfully load a values-only/no-macro version of the workbook. > wb2 <- loadWorkbook("Mar_SP_20130227_V6.1_VALUES_ONLY.xlsx") > wb2 [1] "Mar_SP_20130227_V6.1_VALUES_ONLY.xlsx" What could be causing the error? From the maintainer's website I can

openxlsx not able to read from .xlsx file in R

有些话、适合烂在心里 提交于 2019-11-29 11:31:14
I am trying to read value from a .xlsx file using openxlsx package in R . In simple words, I need to write a row of data, which then populates some output cell that has to be read back in R. I will share an example to better explain the problem. Initial state of the .xlsx file: I'm now trying to write new values to the cell : A2:A3 = c("c", 5). So ideally, I'm expecting A6 = 15 Below is the code used : require(openxlsx) path <- "C:/path_to_file/for_SO1.xlsx" input_row <- c("c", 5) # Load workbook; create if not existing wb <- loadWorkbook(path) # createSheet(wb, name = "1") writeData(wb, sheet

How to extract sheet names from Excel file in R

老子叫甜甜 提交于 2019-11-28 09:45:02
I have loaded a workbook into R and read in the worksheets using xlConnect, but I was wondering if there was a way of extracting the names of the sheets perhaps in a vector? So far my code is: dataIn<-loadWorkbook(file.path(filenames[1],sep="")) lst = readWorksheet(dataIn, sheet = getSheets(dataIn), startRow=1, startCol=1, header=TRUE) ...and I want to extract the sheet names of the sheets in lst . You are looking for getSheets Returns all worksheet names in a workbook. Another really nice package developed by the folks at RStudio is readxl . It's easy to get the excel sheet names with the

How to fix OutOfMemoryError (Java): GC overhead limit exceeded in r? [duplicate]

孤人 提交于 2019-11-28 08:25:10
This question already has an answer here: “Out of Memory Error (Java)” when using R and XLConnect package 7 answers I have to read a file in a list of folders and save data in R. I use following code for my test data and it works. When I use the code for the actual data then I get this error Error: OutOfMemoryError (Java): GC overhead limit exceeded Called from: top level This is what I have done for my test data parent.folder <- "C:/Users/sandesh/Desktop/test_R" sub.folder <- list.dirs(parent.folder, recursive =TRUE)[-1] file <- file.path(sub.folder, "sandesh1.xlsx") library(xlsx) library

xlConnect R use of JVM memory

你说的曾经没有我的故事 提交于 2019-11-28 06:11:19
问题 I'm running into a problem with JVM memory using XLConnect (Mirai Solutions) in R. Data loads into R just fine using loadWorkbook or readWorksheetFromFile , but larger data (data frames about 3MB) get stuck while being written to the JVM during export with any of the export functions ( writeNamedRegion , writeWorksheetToFile , etc.), and R stops responding. I've reset the java parameters using options(java.parameters = "-Xmx1500m") , and this increased the size of the data frames I was able

openxlsx not able to read from .xlsx file in R

会有一股神秘感。 提交于 2019-11-28 05:07:57
问题 I am trying to read value from a .xlsx file using openxlsx package in R . In simple words, I need to write a row of data, which then populates some output cell that has to be read back in R. I will share an example to better explain the problem. Initial state of the .xlsx file: I'm now trying to write new values to the cell : A2:A3 = c("c", 5). So ideally, I'm expecting A6 = 15 Below is the code used : require(openxlsx) path <- "C:/path_to_file/for_SO1.xlsx" input_row <- c("c", 5) # Load

How to fix OutOfMemoryError (Java): GC overhead limit exceeded in r? [duplicate]

只谈情不闲聊 提交于 2019-11-27 01:52:15
问题 This question already has an answer here: “Out of Memory Error (Java)” when using R and XLConnect package 7 answers I have to read a file in a list of folders and save data in R. I use following code for my test data and it works. When I use the code for the actual data then I get this error Error: OutOfMemoryError (Java): GC overhead limit exceeded Called from: top level This is what I have done for my test data parent.folder <- "C:/Users/sandesh/Desktop/test_R" sub.folder <- list.dirs