Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

An R package to interact with Excel files using the Apache POI java library

NotificationsYou must be signed in to change notification settings

colearendt/xlsx

Repository files navigation

CRAN VersionCodecov test coverageR-CMD-checkCRAN ActivityCRAN History

xlsx

An R package to read, write, format Excel 2007 and Excel 97/2000/XP/2003 files

The package provides R functions to read, write, and format Excel files. It dependson Java, but this makes it available on most operating systems.

Install

Stable version from CRAN

install.packages('xlsx')

Or development version from GitHub

devtools::install_github('colearendt/xlsx')

Common Problems

This package depends on Java and therJava package to make the connection between R and Java seamless. In order to use thexlsx package, you will need to:

  • Ensure you have ajdk (Java Development Kit, version >= 1.5) installed for your Operating System. More information can be found onOracle's website

  • Ensure that the system environment variableJAVA_HOME is configured appropriately and points to yourjdk of choice. Typically, this will be included in yourPATH environment variable as well. Options and system environmental variables that are available fromR can be seen withSys.getenv()

  • Particularly on UNIX systems, if you continue experiencing issues, you may need to reconfigureR's support for Java on your system. From a terminal, use the commandR CMD javareconf. You may need to run this as root or prepended withsudo to ensure it has appropriate permission.

More detail can be found in therJava docs.

Quick start

To read the first sheet from spreadsheet into a data.frame

read.xlsx2('file.xlsx',1)

To write a data.frame to a spreadsheet

write.xlsx2(iris,file='iris.xlsx')

The package has many functions that make it easy to style andformalize output into Excel, as well.

wb<- createWorkbook()s<- createSheet(wb,'test')cs<- CellStyle(wb)+   Font(wb,heightInPoints=16,isBold=TRUE)+  Alignment(horizontal='ALIGN_CENTER')r<- createRow(s,1)cell<- createCell(r,1:ncol(iris))setCellValue(cell[[1]],'Title for Iris')for (iincell) {  setCellStyle(i,cs)}addMergedRegion(s,1,1,1,ncol(iris))addDataFrame(iris,s,row.names=FALSE,startRow=3)saveWorkbook(wb,'iris_pretty.xlsx')

Issues/Mailing list

To report a bug, use the Issues page at:https://github.com/colearendt/xlsx/issues

If you are wrestling with the Java dependency, there are some very goodalternatives that do not require Java. Your choice will vary depending on whatyou are trying to accomplish.

Acknowledgements

The package is made possible thanks to the excellentwork onApache POI.

Code of Conduct

Please note that the xlsx project is released with aContributor Code of Conduct. By contributing to this project, you agree to abide by its terms.

About

An R package to interact with Excel files using the Apache POI java library

Topics

Resources

Code of conduct

Contributing

Stars

Watchers

Forks

Contributors9


[8]ページ先頭

©2009-2025 Movatter.jp