Questions tagged [openxlsx]

Use this tag for questions related to the openxlsx package. The openxlsx package provides functions to make it easy to read, write and edit XLSX Files in the R programming language.

The package simplifies the creation of Excel files in the programming language by providing a high level interface to writing, styling and editing worksheets. Through the use of , read/write times are comparable to the xlsx () and packages with the added benefit of removing the dependency on Java.

For more information on the package see:

Original author: Alex Walker
Current maintainer: Philipp Schauberger

410 questions
0
votes
4 answers

Importing Excel-tables in R

Is there a way to import a named Excel-table into R as a data.frame? I typically have several named Excel-tables on a single worksheet, that I want to import as data.frames, without relying on static row - and column references for the location of…
MelkorNO
  • 3
  • 4
0
votes
3 answers

How to name excel files as the names of the data frames in a list in R

I have a large list with more than 100 data frames in it. For simplification I show a list with three data frames (dummy data). I would like to write each data frame into an excel file by using openxlsx. I already created a loop, in which each data…
Luker354
  • 659
  • 3
  • 8
0
votes
2 answers

Reading xlsx file in R

I have used this code: library(openxlsx) fileUrl <- "http://d396qusza40orc.cloudfront.net/getdata%2Fdata%2FDATA.gov_NGAP.xlsx" d <- download.file(fileUrl,destfile = "C:/Users/skoma/Desktop/data/dat.xlsx") data <- read.xlsx("dat.xlsx") This is the…
0
votes
0 answers

remove grid lines with R: openxlsx

We would like to remove grid lines in xlsx files with R. This works fine. However, formats are changed. What can we do that the formats are not changed? #packages library(zip) library(openxlsx) #input pathInput <-…
0
votes
0 answers

Is there a way to save a manipulated table back into the original Excel file so it can have two sheets? 1. Original 2. Edited

Is there a way to save a manipulated table back into the original Excel file so it can have two sheets? 1. Original 2. Edited I took an Excel table and removed columns in R; I also filtered out NA values. I am able to save this new table as a new…
EAG
  • 59
  • 6
0
votes
0 answers

With R package openxlsx i am trying to merge columns and rows. though script works it does not allow me to overwrite

I use this script library(openxlsx) Output <- read.xlsx(xlsxFile = "Excel_file.xlsx", fillMergedCells = TRUE,colNames = TRUE) When i do this it works and does what it is supposed to do. The file contains a lot of merged rows and columns.…
user35131
  • 1,105
  • 6
  • 18
0
votes
1 answer

Split large dataframe in R and output into separate sheets in a single Excel workbook

Suppose I have the following dataframe in R and I am looking to split the dataframe into separate Excel sheets categorised by the Fruit column +--------+-------+ | Fruit | Price | +--------+-------+ | Apple | 12 | | Apple | 14 | | Apple |…
sjedi
  • 43
  • 1
  • 7
0
votes
1 answer

How do I set the class of a variable using pipes?

I have create a function that builds a tibble from a few basic inputs library(tidyverse) fun <- function(x, y) { tibble( start = x) %>% mutate(k = x * y) } What I would like to do is set the class of each variable within this function. fun…
0
votes
0 answers

For loop using openxlsx package instead of xlsx package in R

is it possible to write the code below with openxlsx package? im stuck at the createRow line as i think openxlsx doesnt have this function. library(xlsx) linkname = data.frame(fulllist=c("First","Second","Third","Fourth","Fifth"),…
THOMAS K
  • 1
  • 1
0
votes
0 answers

Conditional Formatting in Pivot with openxlsx?

I have an Excel with several sheets, two of which contain pivot tables based on data from other sheets ("data sheets"). Using the openxlsx package, I'm loading the Excel into R and first removing the data sheets and then creating them again with new…
0
votes
1 answer

openxlsx in R - getSheetNames of files in a for loop

I have 3 files. library(openxlsx) file1 <- '/home/mycomp/file1.xlsx' file2 <- '/home/mycomp/file2.xlsx' file3 <- '/home/mycomp/file3.xlsx' fil <- c(file1, file2,file3) Each file has multiple sheets. I am trying to print the sheeetNames from each…
Apricot
  • 2,925
  • 5
  • 42
  • 88
0
votes
3 answers

How to read excel in R with Text Box

I have an excel file which contains some data inside an Text box. The goal is to read the file as it is with the row number intact. I dont want to read what is inside the text box. When I read the file using readxl and openxlsx package, all the…
rajan.sngh
  • 453
  • 2
  • 5
  • 17
0
votes
1 answer

Issue with openxlsx package in R removing data groupings

I am using the Openxlsx package to open an existing Excel file, delete and recreate a tab with new, fresh data. On another sheet in the workbook I have some rows grouped together throughout the sheet using the Group section on the Data tab. When I…
Andrew P
  • 11
  • 2
0
votes
1 answer

Error in as.data.frame.default(x[[i]], optional = TRUE) : cannot coerce class ‘"formula"’ to a data.frame

I have 4 data frames which I am trying to export 4 data frames into same workbook list_of_dataframes <- list( "Scoring" ~ store_score, "Store" ~ store_ware, "Brand" ~…
0
votes
1 answer

R: Merging rows to export to excel

I have to merge the rows of excel if the values in a column are identical (within a Unique Identifier group). I've attached a photo of the current openxlsx output and the desired one. I know in SAS you could use PROC REPORT and it would…
Sheegor
  • 19
  • 1
  • 4