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
0
votes
1 answer

Hide row with xlsx R package

I would like to hide a row in a dataframe that I am writing to Excel using the xlsx package, but can't find a way to do this. xlsx has the option of SheetName$setColumnHidden(index, TRUE) is there no equivalent to hide a single row? I tried…
hdiza
  • 23
  • 2
0
votes
1 answer

Date format issue while writing xlsx in R

Exp is a data frame , as given below: > Exp Branch Date Division 1 2 2023-02-10 820 2 2 2023-02-10 280 3 2 2023-02-10 935 4 2 2023-02-10 359 5 2 2023-02-10 450 > str(Exp) 'data.frame': 5…
Ray
  • 321
  • 2
  • 12
0
votes
0 answers

Autosizing with xlsx package for output

I have this very basic shiny app below. I am hoping there is a way I can auto size all the columns based on the properties of the sheet and not the actual data.frame as my actual coding scenario is more involved. Currently, it doesn't work as you…
0
votes
0 answers

How to run rJava in Mac m1?

I am trying to use write.xlsx and I realized I first needed to run the xlsx library, and therefore the rJava library. I prosive to install the libraries and I got the following error while trying to run rJava: Error: package or namespace load failed…
0
votes
1 answer

How to produce a column containing "values ± error" from two columns with one being "value" and the other being "error"

I am new to both R and asking questions in related forums, so please bear with me. I have raw data, output from a geochemical analysis, which contains a large number of observations for over 200 variables. The output of this analysis generates a…
0
votes
0 answers

R crashes when install xlsx

When I try to install the package xlsx I get fatal error and R server session disconnected. It shows both the bomb with fatal error and server session diconnected even though I am just running it locally. I am running r studio with r version 4.2.2…
0
votes
0 answers

CellBlock function is giving an error related to class after minimal specification

I am having some specific problems with xlsx package after having moved to a newer version of R (4.0.5). You will see that we have an error here for CellBlock function and the only object of note is the sheet itself as the rest are very stock…
0
votes
1 answer

Skip starting blank rows in Excel with XLSX in JavaScript Sheet-JS

I have the following code that works great when the header row is row 1 readerData(rawFile) { return new Promise((resolve, reject) => { const reader = new FileReader(); reader.onload = e => { const data =…
Bill
  • 1,423
  • 2
  • 27
  • 51
0
votes
0 answers

i can't read an excel that i could already read in R, i'm using the tool read.xlsx2

I'm using R and i need to open an excel file, while i'm working with it it appears the next message: Error in .jcall("RJavaTools", "Z", "hasField", .jcast(x, "java/lang/Object"), : RcallMethod: cannot determine object class The function that i'm…
0
votes
0 answers

Is there a R function to add data from a df and append it to a sheet in excel

I have a R code that uses joins from various tables and finally have an output dataframe. I need this to be appended to a new worksheet in excel file that already has three sheets in it. I am on a mac and however I try the library(rjava) that is…
moikoi
  • 25
  • 8
0
votes
1 answer

How can use variables for the row and columns in setCellFormula in the xlsx package in R?

I am trying to create a formula in a cell of an existing Excel document. I can easily do it this way: #Load workbook wb<-loadWorkbook('test.xlsx') #Let this be any xlsx document with borders on cell B1 of Sheet2 #Get tab …
P.A
  • 3
  • 1
0
votes
2 answers

Read Excel file with highlighted cells using R

I have a lot of long Excel files and it is too hard to handle them manually. I'm reading them in R to identify the highlighted yellow cells as in the image The objective: is to loop over the days and the hours in the file in order to construct a…
Flore
  • 97
  • 5
0
votes
1 answer

Reading xlsx with multiple sheets in R for duplication removal

I have a excel file which has multiple sheets embedded in it. My main goal is to basically remove all rows which are appearing multiple times in a single sheet and have to do this for every sheet. I have written the code below but the code is only…
Manu
  • 29
  • 6
0
votes
2 answers

How to write this dataframe to excel (xlsx)?

I have a dataframe of the following format: What i want to do is write it to a .xlsx file as below (everything in one sheet): Not fussed about the column names in the Excel file. Tried subsetting by name and using cbind() but it doesn't work as…
samsamara
  • 4,630
  • 7
  • 36
  • 66
0
votes
2 answers

How to append today's date into the filename to be saved as an Excel Workbook?

I have an R script that saves its output into an Excel Workbook. library(stringr) library(dplyr) library(xlsx) ... write.xlsx(as.data.frame(df31), file='df31.xlsx', sheetName="Sheet1", col.names=TRUE, append=TRUE) Obviously, as per R codes above,…
user3115933
  • 4,303
  • 15
  • 54
  • 94
1 2 3
8 9