Spreadsheets – a Renjin package – Released

I released spreadsheets under the MIT license two weeks ago. Spreadsheets is a package (extension) for Renjin (an implementation of R for the Java Virtual Machine). This package will give you the ability to work with (read, write) spreadsheets. It supports reading of excel and Open Office/Libre Office spreadsheets files. The project is located on github.

To import a spreadsheet into a data.frame you just do:

excelDf <- importSpreadsheet(
    filePath = "df.xlsx",
    sheet = 1,
    startRow = 2,
    endRow = 34,
    startColumn = 1,
    endColumn = 11,
    firstRowAsColumnNames = TRUE

Similarly to export a data.frame to a spreadsheet (Excel or Open Document) is as simple as:

exportSpreadsheet(filePath, df, sheet)

You can also export several data.frame to a spreadsheet in one go:

  filePath = paste0(getwd(), "/dfExport.ods"), 
  dfList = list(mtcars, iris, PlantGrowth), 
  sheetNames = c("cars", "flowers", "plants")

In addition there are several nice utility function such as find a row or a column matching a given value, convert between column indexes and names etc.

Leave a Reply

Your email address will not be published. Required fields are marked *