Questions tagged [r-xlsx]

The xlsx library in R has capabilities for reading and writing Microsoft Excel files

From CRAN:

Provide R functions to read/write/format Excel 2007 and Excel 97/2000/XP/2003 file formats.

xlsx uses Java (through rJava) on the back end to read and write .xls and .xlsx files.

Package written and maintained by Adrian Dragulescu.

126 questions
107
votes
10 answers

Problems when trying to load a package in R due to rJava

When I type require(xlsx) in order to load the package xlsx in R, the following messages is shown: > require(xlsx) Loading required package: xlsx Loading required package: xlsxjars Loading required package: rJava Error : .onLoad failed in…
Pritam Kar
  • 1,071
  • 2
  • 7
  • 3
19
votes
3 answers

read.xlsx reading dates wrong if non-date in column

The xlsx package is reading dates in wrongly. I've read all the top similar Q's here and had a scout round the internet but I can't find this particular behaviour where the origin changes if there's non-date data in a column. I have a tiny Excel…
Spacedman
  • 92,590
  • 12
  • 140
  • 224
18
votes
2 answers

Using R to read out excel-colorinfo

Is there any way to read out the color-index of cells from excel files with R? While I can set the cell color with packages like XLConnect or XLSX, I have found no way to extract the color-information from existing workbooks.
Bens
  • 183
  • 1
  • 4
14
votes
3 answers

MemoryError in R while read.xlsx

I am using the following R code (that utilizes the Java parameter to increase memory as well): library(xlsx) options(java.parameters = "-Xmx1g") library(XLConnect) NiVe <- read.xlsx("version1.xlsx",1) The version1.xlsx file is 13 MB in size. I get…
user1703914
12
votes
3 answers

Using write.xlsx to replace an existing sheet with R package xlsx

I am using package xlsx Version:0.5.7 Date: 2014-08-01. in R version 3.0.1 (2013-05-16) -- "Good Sport" Platform: i386-w64-mingw32/i386 (32-bit). I have an xlsx file with at least 2 sheets (say A and B). I need to read data from A, edit them and…
Filippo
  • 309
  • 1
  • 2
  • 10
10
votes
1 answer

write.xlsx function gives error when defining path with the file name but read.xlsx is fine

I have a problem with the write.xlsx2 function of xlsx R package. For instance, see the code below. main_path<-"~/mydir/" read.xlsx2(paste0(main_path,"my_input_excel.xlsx"), sheetIndex=1) a<-1 write.xlsx2(a,…
berkorbay
  • 443
  • 7
  • 22
7
votes
2 answers

write.xlsx function not working

I am trying to use .xlsx library but function write.xlsx is returning error that such can not be found. When I am installing library(xlsx) in log I can read: Error : .onLoad nie powiodło się w funkcji 'loadNamespace()' dla pakietu 'rJava',…
RafMil
  • 138
  • 2
  • 2
  • 15
7
votes
0 answers

Cannot open the file after writing xlsx file using R openxlsx package

At first, I tried to read and write xlsx files in R (while comparing the output between the xlsx and openxlsx packages). I work on mac os. It worked well to read xlsx files using the read.xlsx() from both packages. However, when it comes to…
snannivale
  • 71
  • 3
7
votes
1 answer

read.xlsx and colClasses

Does anyone know why argument colClasses does not seem to work in read.xlsx? I create a sample *.xlsx file: > library(xlsx) > d1 = data.frame(A=LETTERS[1:3], B=letters[1:3], C=1:3, D=c(1.1, NA, NA)) > str(d1) 'data.frame': 3 obs. of 4 variables: …
user2690051
  • 155
  • 1
  • 1
  • 9
6
votes
6 answers

"Error in addWorksheet(wb, "sheet1") : First argument must be a Workbook"

I am using ‘openxlsx’ package in R. ٰI want to add some data in xlsx file. I have used following code to create the workbook and add worksheet in it. wb=createWorkbook() addWorksheet(wb,"sheet 1") writeData(wb,sheet = 1,"From",startCol =…
Alvi
  • 123
  • 1
  • 3
  • 14
6
votes
1 answer

openxlsx writing if formula from R to excel

I am trying to export from R to excel an dataframe with two columns which I want to fill with the excel if formula so that the user could later on change the thresholds. My question is how can I export a formula like the following IF(C2>4;…
S.K.
  • 365
  • 1
  • 3
  • 17
5
votes
2 answers

R Session Aborted and R encountered a fatal error

I have been using Rstudio for a while and there was no problem until I was trying to install rJava and xlsx package in R. I had updated both my RGui and Rstudio to the latest version (also downloaded java x64 bit for my desktop since earlier I had a…
3
votes
0 answers

How to include file in shiny package?

I'm making a shiny app with golem, which automatically makes it a package and for some background calculations that happen before the user does anything I'm loading in an excel file (just with xlsx's read_xlsx function). This works great on my local…
PanikLIji
  • 31
  • 4
3
votes
2 answers

Although the xlsx package is installed in R, it does not work

Although the xlsx package is installed, it does not work. I get the following error. What should I do? I use the latest version of R install.packages("xlsx") Installing package into ‘C:/Users/Cgdm/Documents/R/win-library/4.0’ (as ‘lib’ is…
Cgdmm
  • 63
  • 1
  • 7
3
votes
1 answer

R (xlsx) - automatically create borders

I have problems to automatically generate borders while exporting an excel file with r. Below is my code and the output I am currently generating and how I would like it to be. I have tried to help myself with the solution here, but could not make…
jerry_k
  • 363
  • 1
  • 5
  • 20
1
2 3
8 9