462 questions
1
vote
0
answers
97
views
Why is wb_add_comment throwing an error when trying to add comments across multiple columns using openxlsx2? [duplicate]
I have a dataframe which I am trying to export to Excel with formatting and comments. To do this I have created a custom function using functions in the `openxlsx2' package to add color fill and/or ...
0
votes
0
answers
85
views
openxlsx: Writing multi-column XLOOKUP formulas produces unexpected @ or {} in Excel
I’m trying to use the R package openxlsx to map data from one sheet (Source) to another (Target) in Excel using XLOOKUP. The idea is to use multiple key columns to perform the lookup.
Here is the ...
2
votes
2
answers
137
views
Writing an Excel file in combination with purrr::map leads to an error
I have a simple list like
library(tidyverse)
library(openxlsx)
mtcars |>
group_split(cyl)
And now I want to save each list as an Excel file to the folder specified in cyl like so:
mtcars |>
...
3
votes
1
answer
77
views
How to do conditional formatting a cell based on another column
I have following df and could like to output to an Excel file. Is it possible to add a highlight to S1:S5 with a condition Cell Value = Value in Line.
I did look through the condtionalFormatting() but ...
1
vote
1
answer
79
views
How to write multiple named sheets to excel workbook using openxlsx
I need to use the openxlsx library due to java issues at my institution.
I have a list of dataframes called data_list that are simply named 1, 2, 3, etc.
> data_list
$`1`
Count TaxID ...
0
votes
3
answers
125
views
How list in pandas dataframe can be converted into multiple cells with no duplicate values?
I have this kind of data:
[{"id": 1, "name": "Alex", "projects": ["A", "B", "C"]}, {"id": 2, "name": "Bob&...
2
votes
2
answers
105
views
Read in all Excel files from folder and create separate datasets for each Excel file by merging sheets together
I have seen a lot of questions involving reading in all the Excel files from folder and merging them all together, however my situation is a bit different where each Excel file contains different data....
1
vote
1
answer
80
views
Importing all the excel worksheets from excel workbooks in a folder as separate datasets in R
I would like to write a function to read in all the excel worksheets of all the excel workbooks in a folder as separate datasets each named after the workbook and sheet.
For example, if the folder ...
1
vote
2
answers
127
views
How to properly add external cmake library (OpenXLSX) to a Qt creator qml project?
I'm q newbie and i searched for the solution across the web making some "minor" progress but i'm pretty sure that i'm do things wrongly and there are very few video and tutorial about that, ...
2
votes
1
answer
208
views
Conditional formatting cells with exact text using openxlsx
I am exporting data into an xlsx file using the openxlsx R library, and wish to format cells conditionally based on the exact text they contain. To make the example simpler, let's pretend I want cells ...
0
votes
1
answer
58
views
openxlsx and writeData in parallel
I'm trying to parallelise with openxlsx and its function writeData the export of many Excel individual files that should be somehow summarised in a central Excel file.
As can be shown in the reprex ...
0
votes
1
answer
31
views
Replacing a string when writing to setHeaderFooter() in openxlsx
I am writing datasets to Excel using the openxlsx and openxlsx2 packages. The report generated from this code has to be updated on a monthly basis, so the header/footer annotations need to reflect ...
2
votes
3
answers
140
views
Is there in R a 2-dimension object that can contain mixed data types within one column across different rows?
I have a list a that I need to transform to a data frame with 17 rows and 2 columns.
a <- list("01-step" = list("41 - 41" = c(41, 41), "7 - 7" = c(7, 7), "10 - 10&...
0
votes
1
answer
58
views
How to apply formatting to the Total row of a dataframe being exported to Excel
I'm exporting a few dataframes to an excel document using the openxlsx package and using the createStyle() and addStyle() functions to apply aesthetics. However, my "total" row is not being ...
1
vote
2
answers
113
views
Failed to keep the first empty rows when importing data from Excel into R
I'd like to keep the full data, including any empty rows and columns, when importing. However, I am not sure why the read.xlsx() function from the openxlsx package does not achieve this if the first ...
2
votes
1
answer
165
views
How can I export an excel file with highlighting and comments in R? [duplicate]
I would like to know if there is a way to export a data frame/tibble from R as an .xlsx file with highlighting and comments added natively from the R console rather than post-processing in Excel.
I ...
2
votes
1
answer
566
views
Is there an R function to wrap text within a cell in an Excel output?
I'm writing a script to render an Excel output using openxlsx, and I'm having a hard time wrapping text within a cell.
I have a "Report Notes" sheet in my output with the usual disclaimers ...
0
votes
1
answer
60
views
Relatively call up all columns in a worksheet using setColWidths() for auto-sizing
I'm preparing an Excel workbook using the openxlsx package, and I want to use setColWidths() to auto-resized the columns in each sheet. Since I have multiple sheets and I want my code to be relative, ...
2
votes
2
answers
111
views
Exporting multiple tables to xlsx in R
I am trying to export a set of tables to an excel sheet. However I am using a for loop to create different sheets which means that in some cases not all of the tables exist. Does anyone know how to ...
0
votes
0
answers
147
views
Changing font colour in XLSX file preserving all other style features using openxlsx2
Necessary preamble that will explain my clumsy syntax below: I am a novice with R and having developed in Python for ages I find the R syntax to be unclear form a OOP perspective (i.e. hard to find ...
1
vote
1
answer
109
views
Using for loop in openxlsx to copy down formula -- more efficient method ideas?
Currently using the following structure and syntax to copy down a formula in openxlsx workbook.
for(i in 1:10){
writeFormula(wb, tab_name, paste0('SUMIFS(A:A,B:B,A',i',), startRow = i, startCol = 1)
...
0
votes
2
answers
77
views
Implicit excel @ in openxlsx unique formula in R
I'm trying to produce a table that checks two different table columns, stacks them together to check unique values. When I write this formula manually in excel, it works as expected, but when produced ...
0
votes
1
answer
64
views
Stuck on openxlsx error in function to import multiple excel files into R
I am attempting to write a function to read in multiple excel files into R, however I am trying to use openxlsx specifically because later on in my program I want to output specific columns/rows into ...
0
votes
1
answer
50
views
How to save and download two reactive dataframes in separate tabs of a common excel file?
I have the shiny app below in which I have two reactive dataframes. I want when I click download to download one excel file with both dataframes in two different tabs with their names if possible.
...
2
votes
0
answers
86
views
R openxlsx - how to create overflowing array formula?
I am trying to create an overflowing array in R using openxlsx. My end result will have the user change items into row 1, so I need the UNIQUE formula to dynamically add/remove values after exporting.
...
0
votes
0
answers
108
views
Openxlsx Excel file with hyperlinks not working in Protected View
I'm making excel files that contain hyperlinks in some cells using the openxlsx package.
However, when you download the file from the Shiny app, it opens in Protected view. Trying to click on the link ...
0
votes
2
answers
228
views
Not able to create an array formula using the openxlsx package writeFormula function
Using the openxlsx r package to write data to excel. Needing to include excel formulas that can be edited by end users so I'm using the openxlsx::writeFormula function to create array formulas that ...
0
votes
1
answer
119
views
openxlsx formula is not translating correctly
I want to implement the following formula using openxlsx: =IF(COUNTIF(E3:G3,"none")=3,"N/A",AVERAGE(IF(ISNUMBER(--E3:G3),--E3:G3,""))) to each row
This formula works ...
0
votes
1
answer
102
views
Color code values conditionally in xlsx produced by openxlsx package in R in a loop
My reproducible code below writes a super small .xlsx file that has two sheets.
I was wondering if there might be a way to color-code values of 3 in red, 4 in orange, and 5 in green anywhere in the ...
1
vote
1
answer
112
views
Using pugixml and OpenXLSX in the same project results in a linker error
I have a CMake&C++ project where I prepared a condensed wrapper for pugixml. This wrapper is then linked to my io.lib library and works nicely on both ubuntu-22.04 and windows-latest.
I then added ...
2
votes
1
answer
302
views
How to read floats from XLSX file with OpenXLSX
I'm trying to read a set of data from my Excel file.
I am able to read the integers from the first column:
const auto sdf = sheet.cell(fmt::format("A{}", rowIndex)).value().get<int>();...
0
votes
0
answers
360
views
How to include OpenXLSX in a library with CMake
I'm trying to make use of the OpenXLSX in my c++ project.
I added the source code with a git submodule using command
git submodule add [email protected]:troldal/OpenXLSX.git external/OpenXLSX
which ...
1
vote
0
answers
65
views
Read an Excel file which contains hyperlinks [duplicate]
I need to read an excel file into R.
I am using the following code:
library(readxl)
data <- read_excel("path/to/file.xlsx")
The Excel file looks like this:
I would like to read the file ...
0
votes
1
answer
250
views
Formatting using addstyle in openxlsx package
Question 1
In the code below, while performing the run, all the outputs is displayed in RStudio console.
This particularly happens if the code add style is in the loop for different workbook tabs. I ...
0
votes
1
answer
87
views
Issue with loading file from URL, only where located in certain places
I have an issue with loading data from a Dropbox folder, and have absolutely no idea why. Several posts suggest that the issue can be solved by closing the file before loading it, but it's obviously ...
1
vote
1
answer
201
views
I need to export my data frame with colour conditional formatting on specific rows in R
I have a dataframe, df1 which is data manipulated from an imported excel, and I need to export it back out to have specific formatting that the original file had - it has many columns, but essentially ...
2
votes
1
answer
152
views
Display .xlsx contents as a HTML table
I can read a formatted .xlsx file using the openxlsx package and the loadWorkbook function and further edit it as needed.
How can I display this data as a HTML table in a Shiny app? Exact styling is ...
0
votes
0
answers
91
views
loadworkbook in R including charts
I have an xlsx workbook on my desktop with existing sheets. Some of the sheets includes charts (e.g. line chart). I have a dataframe in R that I would like to write into a sheet in this workbook and ...
1
vote
1
answer
359
views
Excel formula not updating after writing new data through R openxlsx package
I'm trying to automate some processes in Excel using R language and openxlsx library.
When I write new data to a cell (which works fine) that is a reference to a formula in other cells, those cells ...
1
vote
0
answers
295
views
How to write complex formula with openxlsx?
I have the following table with cells containing numbers from -1 to 10 (decimal places allowed). In some cases there is a trailing A behind the number.
Now, I would like to extract all digits from the ...
1
vote
1
answer
83
views
R Group option not working when creating barplot on separate sheet to data using openxlsx2 and mschart
I need to create a bar chart in Excel on a separate sheet to the data. The only way I have managed to do this is by adding the data to the workbook object then referencing that as the data source for ...
1
vote
1
answer
139
views
Conditional formatting using openxlsx and createStyle()
I would like to create conditional formatting for a correlation matrix where cells with correlation coefficients 0.75 to 1 and -0.75 to -1 have green backgrounds with black font (see provided code). ...
0
votes
2
answers
472
views
Openxlsx2 does not write tables correctly - it fist converts them to dataframes when writing to Excel
I create a two way table in R using the following code
t <- table(df[["Sex"]], df[["C or Better"]], useNA = "ifany")
colnames(t)[is.na(colnames(t))] <- "Blank&...
0
votes
1
answer
116
views
Excel Report Generation Issues with openxlsx in R Shiny App
I'm developing a Shiny app that processes financial data and generates a formatted Excel report. The data processing part works perfectly as a standalone script, but when integrated into Shiny, the ...
1
vote
0
answers
71
views
R Programming: Issue with writeData Function and updated_origin in Excel - Incorrect Results in Specific Cases
I would like to know what's causing my problem. Whenever I write anything related to updated_origin in Excel.(Example: writeData(wb,"sheet3",x = multiply,xy = c(c,r+2)) It will always give ...
0
votes
1
answer
69
views
How to combine colour formatting with 0.000 format in openxlsx package in r?
Im using openxlsx library in R. Excel output of my code is not considering 0.000 format and in my excel output instead of numbers like -0.019 I can see only 0 or 1 (underneath they have good numbers).
...
0
votes
1
answer
167
views
openxlsx how to highlight cells by comparing with another sheet
I want to compare two sheets values, and highlight the difference, below is a simple example, can someone help me to out about how to write the rule=? Thanks
wb \<- createWorkbook()
addWorksheet(wb,...
1
vote
0
answers
119
views
sprintf error when using the openxlsx datavalidation for a list
I'm trying to create an R code which can automatically make excel sheets with drop down lists. I'm using the openxlsx package for this with their Datavalidation function.
When I run the file for each ...
0
votes
1
answer
253
views
Export character column to Excel and add thousands separator to numbers
I have a data frame with a column that contains both text and numbers. As a consequence, the type of this column is character. The numbers have a dot as a decimal separator and no thousands separator.
...
1
vote
0
answers
117
views
Adding a comment fill color in Excel using openxlsx
I'm creating Excel files using an R script. In the script, I want to add comments to several cells and then edit the style of these comments. So far, I have seen that I can use the createStyle() ...