An R package for convert dataframes to Excel files
Questions tagged [writexl]
45 questions
1
vote
1 answer
Package "writexl" don't install in R (Linux)
I am trying to install the "writexl" package in my system to use in my college.
The RStudio give an error, and don't install. Using Linux Mint 21, but I tried on Fedora 36 too.
The output from RStudio:
> install.packages("writexl")
Installing…

gaasantana
- 11
- 1
1
vote
1 answer
I want to add a new sheet and avoid replacing the existing sheet in excel while using the writexl package in R
I am using writexl package in R to export data frames to excel sheet.
library(writexl)
However when I use the following code the new data frame (resordered2) replaces the existing excel sheet instead of exporting into the new sheet (Sheet2) as…

bsun
- 11
- 2
1
vote
1 answer
R - Keeping column names after merging multiple .xlsx files
I want to merge columns of multiple xlsx files (about 100) which all have the same structure, meaning the all have 5 rows and 2 columns.
I'm using the answer provided here (with a slight edit to merge the columns instead of…

maryam
- 101
- 5
1
vote
2 answers
Error when trying to export data frame using write_xlsx
Been using R for around two years now and this is the first time i've encountered this issue. I have a data.frame with approx 31,000 rows and 400 cols and I want to export to an excel sheet using write_xlsx
When I try this I get the following…

pdunbar
- 33
- 1
- 5
1
vote
1 answer
Write an intact data frame to an excel sheet in R
I loaded an sheet form excel in R and want to write a section of it to a new sheet, using the original column names.
Firs attempt:
weekdata <- Data [ which(Data$week ==weeknr ),]
write.xlsx2(x=weekdata, file=Document,
sheetName…

Walter Leonard
- 23
- 6
1
vote
0 answers
Dynamic naming of objects in list
I'm using the write_xlsx function from the writexl package. I want to use the list function to dynamically name the tabs in the Excel files I am writing.
Code I have already tried:
Tab_Name = paste0(Input$IndicatorID_RC[i])
Pulls through the…

Chris_Austwick92
- 11
- 1
1
vote
1 answer
Write Inf (numeric) into excel and read it back into R. Inf is char, rather than numeric
After writing Inf (as numeric) into excel, I read it back again and get Inf as Char. For NaN, it becomes NA. For NA, it remains NA as numeric, which is supposed to be.
I used both readxl and writexl. I tried to install tibble and…

ESG
- 11
- 3
1
vote
2 answers
R: write_xlsx with evaluation problem in argument
I have a loop like this:
library(writexl)
file_output="C:/test/test.xlsx"
for(i in 1:2){
df<-iris[i,]
write_xlsx(list(i=df),file_output)
}
I would like to store each iteration in a separate sheet named the value of i (or in my real…

Helen
- 533
- 12
- 37
0
votes
1 answer
Exporting a variable to Excel in R
I created a correlation of several variables in R.
df <- read_excel("~/R/Track/Cumulative_2023.xlsx")
Rel <- cor(df[, c('Speed', 'Axis', 'Horz', 'Ext', 'Zone', 'Rel')], use="complete.obs")
I am using the code:
W <- write.xlsx(Rel, file =…

mrax25
- 1
- 2
0
votes
2 answers
write_xlsx results in error: "Argument x must be a data frame or list of data frames" This despite data being a list of DFs
I need to write an excel file with multiple sheets named "Cases", "Coordinators", "Contacts"
I have checked the class of each--e.g., class(Cases)--and the result in each case is:
class(Cases)
[1] "tbl_df" "tbl" "data.frame"
I combine…

techieshrink
- 3
- 3
0
votes
1 answer
Error : "Argument x must be a data frame or list of data frames" in RStudio while exporting data to Excel Sheet
# ----
setwd("F:/Business Analytics/Shares Monitor")
getSymbols("TATACONSUM.NS", src="yahoo")
library("writexl")
write_xlsx("TATACONSUM.NS","F:/Business Analytics/Shares Monitor//Stock_TATACONSUM-NS.xlsx")
# ----
I have written the above code to…
0
votes
1 answer
Row Values not appearing in Output
I have data that is formatted like so. I would like to calculate the percent of enrollment associated with each racial group.
building <- c(1, 2)
total_enrollment <- c(100, 200)
black_count <- c(32, 69)
hispanic_count <- c(10, 19)
white_count <-…

ra_learns
- 51
- 6
0
votes
0 answers
Select specific data frames from global environment
I would like to export 100 data frames to an excel sheet and for this I thought I would create a list contening all the data frames and then use write_xlsx to export it. When I run the following code I get this error message : "Argument x must be a…

David Potrel
- 111
- 8
0
votes
1 answer
Excel to R, value changes when importing with readxl
I am quite new to R. I need to work with a number of lists that I have in excel, but when importing them with readxl the numbers seem to be changing.
I have a spreadsheet (example here), and when I subtract the sum of the tab "target_intputs" to the…

vabm
- 285
- 7
- 16
0
votes
1 answer
excel sheets with same prefix to a new excel file in R
I am trying to split excel file with multiple sheets to a new file based on prefix in sheet name.
I would like to output all sheets with prefix a_ to a.xslx , b_ to b.xslx and so on
Here is the code so…

Rdu U
- 57
- 4