openxlsx | openxlsx - a fast way to read and write complex xslx files | Development Tools library
kandi X-RAY | openxlsx Summary
kandi X-RAY | openxlsx Summary
[openxlsx] .
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of openxlsx
openxlsx Key Features
openxlsx Examples and Code Snippets
Community Discussions
Trending Discussions on openxlsx
QUESTION
How do I conditionally format an Excel according to another column? I am trying to color code numbers in columns 1 and columns 2 according to if they are less than the values in the column value
.
This code snippet right below works, but I want to replace the rule = "<500"
with a column so it is more dynamic. I keep getting errors and have tried a few things.
ANSWER
Answered 2022-Apr-01 at 23:10I haven't worked with R, but the formula in Excel would be
QUESTION
I created an R Markdown to check for errors in a series of datasets (e.g., are there any blanks in a given column? If so, then print a statement that there are NAs and which rows have the NAs). I have setup the R Markdown to output a bookdown::word_document2
. I have about 100 datasets that I need to run this same R Markdown on and get a word document output for each separately.
Is there a way to run this same R Markdown across all of the datasets and get a new word document for each (and so they are not overwritten)? All the datasets are in the same directory. I know that the output is overwritten each time you knit the document; thus, I need to be able to save each word document according to the dataset/file name.
Minimal Example
Create a Directory with 3 .xlsx Files
...ANSWER
Answered 2021-Aug-09 at 13:54You could call render
in a loop to process each file
passed as a parameter :
QUESTION
Consider the following code block from the r package openxlsx.
I'm trying to fill certain cells in the excel spreadsheet with a particular color.
This is the code I used in order to do this.
...ANSWER
Answered 2022-Mar-24 at 10:47Use fgFill
instead of bgFill
. bgFill
is for conditional formatting.
QUESTION
I created an error alert for when a file of format other than ".xlsx"
is loaded in fileInput
. For that I created sendSweetAlert
. This is working. What I would like now is the following: Whenever I load a ".xlsx"
file, apparently the code does not give any error, however I would like to accept only ".xlsx"
files, which are actually usable by my function.
The file I use can be downloaded from this link: encurtador.com.br/dqsOQ
...ANSWER
Answered 2022-Mar-15 at 00:16Try this
QUESTION
I wish to add subheader and subtotal/margin rows within a table. Ultimately, I am looking for a structure shown below, which I will export to Excel with openxlsx
and writeData
.
I suspect the subheaders and subtotals are completely different questions, but I am asking both here in case there is a common method related to each.
Reproducible Code So FarCreate the Sample Data (long format):
...ANSWER
Answered 2022-Mar-02 at 18:04Instead of applying adorn_totals
on the entire summary, use group_modify
and then convert to gt
QUESTION
I want to be able to update the selection available in the pickerInput based upon the selection made in the radio button input. In the example below, I want the radio button "A", to give a pickerInput list of mtcars$cyl, whilst a picker input of "B" to give a picker input of mtcars$mpg
I have tried doing this using if statements, but I haven't got anywhere so far. Reproducible example below:
...ANSWER
Answered 2022-Feb-26 at 12:09The server has to listen to the right UI Element (ID = "type" for the radio buttons in question). Currently it observes an undefined element "dist".
Try changing
QUESTION
I have a large dataset with time stamps. The original data contained the time format like this:
...ANSWER
Answered 2022-Feb-11 at 20:09The numbers look like unix epoch, which can be converted to date with the origin 1970-01-01
QUESTION
I have several cities with stats stored into dataframes lists (each list have one dataframe for each city). I want to create an excel sheet with all the dataframes for each city. Each dataframe will be stored in a different tab.
This is my code :
...ANSWER
Answered 2022-Feb-08 at 23:38Finally I fixed my issue using
QUESTION
I am trying to create function for formatting every tables in xlsx file.
I want to save N numbers of Tables in xlsx and formatting all the tables in xlsx file. but its formatting the first table only.
...ANSWER
Answered 2022-Feb-08 at 08:31Here is a function that formats each element of the list of data frames. With R scoping rules what they are, notice format_tbls
returns a workbook object, which allows the updates that occur inside the function to be passed to the object that is eventually saved to a file.
Note: I attempted to follow the formatting shown in the original question, but I have excluded the 'Na_string' addStyle
call. This probably was intended to highlight NA's in the data.frames. The current code does not do that.
QUESTION
I'm using openxlsx
to write data from a data frame to an excel file. I need the data to be coloured given some rules (eg if the value of a cell is A1 & B1
colour the cell with red).
The problem is that this doesn't seem to work when the string representing the rule contains the following characters: &, *
. I assume that there might be more characters having an unusual behaviour, but for these two I've experienced the following:
&
: if & is in the rule then the Excel file gets corrupt and it doesn't even open properly*
: if * is in the rule then all the cells are getting coloured regardless of their content, which is not the expected outcome
Here's the code I'm using:
...ANSWER
Answered 2022-Feb-07 at 21:08Following this post you have to "escape" a literal *
using a tilde. The &
is a bit more tricky. But I remembered that I already had a similar issue when creating a docx
and voila same solution applies here: You could replace a &
by its html entity &
:
Note: Additionally, as I guess that you want to start the conditional formatting in row 2 ... : 2:nrow(df)+1
will add +1
to each element of the sequence 2:nrow(df)
. To fix that use parantheses or do 1:nrow(df)+1
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install openxlsx
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page