This function provides a high level API for writing a data.frame
to
an Excel 2007 worksheet. It calls several low level functions in the
process. Its goal is to provide the conveniency of
write.csv
by borrowing from its signature.
Internally, write.xlsx
uses a double loop in over all the elements of
the data.frame
so performance for very large data.frame
may be
an issue. Please report if you experience slow performance. Dates and
POSIXct classes are formatted separately after the insertion. This also
adds to processing time.
If x
is not a data.frame
it will be converted to one.
Function write.xlsx2
uses addDataFrame
which speeds up the
execution compared to write.xlsx
by an order of magnitude for large
spreadsheets (with more than 100,000 cells).
The default formats for Date and DateTime columns can be changed via the two
package options xlsx.date.format
and xlsx.datetime.format
.
They need to be specified in Java date format
http://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html.
Writing of password protected workbooks is supported for Excel 2007 OOXML
format only. Note that in Linux, LibreOffice is not able to read password
protected spreadsheets.