Git Product home page Git Product logo

xlsx's Introduction

AppVeyor Build Status Travis-CI Build Status CRAN Version

codecov.io CRAN Activity CRAN 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 depends on 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('dragua/xlsx')

Common Problems

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

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

  • Ensure that the system environment variable JAVA_HOME is configured appropriately and points to your jdk of choice. Typically, this will be included in your PATH environment variable as well. Options and system environmental variables that are available from R can be seen with Sys.getenv()

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

More detail can be found in the rJava 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 and formalize 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 (i in cell) {
  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/dragua/xlsx/issues

Questions should be asked on the dedicated mailing list

Acknowledgements

The package is made possible thanks to the excellent work on Apache POI.

xlsx's People

Contributors

alyst avatar colearendt avatar dragua avatar gorcha avatar lawilliams avatar sherrillmix avatar tk3369 avatar zeehio avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.