This package uses John McNamara's C library libxlsxwriter and Rcpp to let R users generate customized XLSX files in R. The WriteXLS
package on CRAN is nice, but it requires Perl, and it isn't flexible enough to allow the user to fully customize their Excel output.
With RcppXLSXwriter
you have the ability to customize each and every cell in your XLSX document.
So far I have only been able to get the package to build on 32-bit R on Windows.
Although RcppXLSXwriter
only has its bare infrastructure, you still get most of the functionality of libxlsxwriter if you're willing to be verbose.
new(XLSXworkbook, *file*)
new(XLSXworksheet,*workbook*,*sheetname*)
write
by specifying the x and y range you want to fill, and then giving a character matrix of the same dimensionnew(XLSXformat,*workbook*)
,adding properties to the format object with its methods, and then passing it to writef
Here is a quick example for writing iris
with bold, exciting header:
library(RcppXLSXwriter) # create workbook wb <- new(XLSXworkbook, "newFile.xlsx") # create worksheet ws <- new(XLSXworksheet, wb, "firstSheet") # create format for title titleFmt <- new(XLSXformat, wb) # set format to font 24, times new roman, bold, underline, and italic titleFmt$font_size(24) titleFmt$font_name("times new roman") titleFmt$bold() titleFmt$underline() titleFmt$italic() # write title ws$writef(1,seq_len(ncol(iris)),t(as.matrix(names(iris))),titleFmt) # write data ws$write(1+seq_len(nrow(iris)),seq_len(ncol(iris)),as.matrix(iris)) # close wb$close()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.