Export formatted R to Excel data

Asked

Viewed 5,017 times

6

Suppose a data.frame like this:

tabela <- structure(list(vendedor = structure(1:4, .Label = c("A", "B", 
"C", "D"), class = "factor"), Total = c(3300, 440, 1020, 200)), .Names = c("vendedor", 
"Total"), row.names = c(NA, -4L), class = c("tbl_df", "tbl", 
"data.frame"), drop = TRUE)

How to export it in Excel by placing details such as title, subtitle, size and font formatting of texts and numbers? In this question there are package suggestions to save in Excel, however it is not about how to format the data.

1 answer

4


With the Writexls package, you can do some things.

The syntax is this:

WriteXLS(x, ExcelFileName = "R.xls", SheetNames = NULL, perl = "perl",
verbose = FALSE, Encoding = c("UTF-8", "latin1"),
row.names = FALSE, col.names = TRUE,
AdjWidth = FALSE, AutoFilter = FALSE, BoldHeaderRow = FALSE,
FreezeRow = 0, FreezeCol = 0,
envir = parent.frame())
  • If AdjWidth = TRUE, adjusts the width of each column by the longest value.

  • If AutoFilter = TRUE, xlx spreadsheet already comes out with autofilter

  • If BoldHeaderRow = TRUE, name of each column in bold

The commands FreeRow and Freezecol indicate which columns should come out frozen.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.