Package‘xlsx’February20,2015TypePackageTitleRead,write,formatExcel2007andExcel97/2000/XP/2003filesVersion0.5.7Date2014-08-01DependsrJava,xlsxjarsLazyLoadyesAuthorAdrianA.DragulescuMaintainerAdrianA.Dragulescuadrian.dragulescu@gmail.comDescriptionProvideRfunctionstoread/write/formatExcel2007andExcel97/2000/XP/2003fileformats.LicenseGPL-3URL://groups.google.com/group/R-package-xlsxBugReports:32:07Rtopicsdocumented:xlsx-package........................................2+.CellStyle........................................4addDataFrame........................................5addHyperlink........................................6Alignment..........................................8Border............................................9Cell.............................................10CellBlock..........................................12CellProtection........................................14CellStyle..........................................1512xlsx-packageComment..........................................17DataFormat.........................................18Fill..............................................19Font.............................................20NamedRanges........................................22OtherEffects.........................................23Picture............................................25POI_constants........................................27PrintSetup..........................................27read.xlsx...........................................29readColumns........................................31readRows..........................................33Row.............................................34Sheet............................................35Workbook..........................................37write.xlsx..........................................38Index40xlsx-packageRead,write,formatExcel2007andExcel97/2000/XP/2003filesDescriptionThexlsxpackagegivesprogramaticcontrolofExcelfilesusingR.AhighlevelAPIallowstheusertoreadasheetofanxlsxdocumentintoadata.frameandwriteadata.frametoafile.Lowerlevelfunctionalitypermitsthedirectmanipulationofsheets,rowsandcells.Forexample,theuserhascontroltosetcolors,fonts,dataformats,addborders,hide/unhidesheets,add/removerows,add/removesheets,etc.Behindthescenes,thexlsxpackageusesajavalibraryfromtheApacheproject,(Ex-cel,Word,PowerPoint,Outlook,Visio,etc.)ByusingtherJavapackagethatlinksRandJava,wecanpiggybackontheexcellentworkalreadydonebythefolksattheApacheprojectandprovidethisfunctionalityinR.ThexlsxpackageusesonlyasubsetoftheApachePOIproject,namelytheonedealingwithExcelfiles.Allthenecessaryjarfilesarekeptinpackagexlsxjarsthatisimportedbypackagexlsx.Acollectionofteststhatcanbeusedasexamplesarelocatedinfolder/tests/.Theyareagoodsourceofexamplesofhowtousethepackage.Pleasesee://code.google.com/p/rexcel/issues/list.Questionsshouldbeaskedonthededicatedmailinglistat:xlsxType:PackageVersion:0.5.7Date:2014-08-01License:GPL-3Author(s)AdrianA.DragulescuMaintainer:AdrianA.Dragulescuadrian.dragulescu@gmail.comReferencesApachePOIprojectforMicrosoftExcelformat::(evenifyouareJavashy.)SeeAlsoWorkbookforwaystoworkwithWorkbookobjects.Examples##Notrun:require(xlsx)#exampleofreadingxlsxsheetsfile-system.file(tests,test_import.xlsx,package=xlsx)res-read.xlsx(file,2)#readthesecondsheet#exampleofwritingxlsxsheetsfile-paste(tempfile(),xlsx,sep=.)write.xlsx(USArrests,file=file)##End(Notrun)4+.CellStyle+.CellStyleCellStyleconstruction.DescriptionCreatecellstyles.Usage##S3methodforclass'CellStyle'cs1+objectArgumentscs1aCellStyleobject.objectanobjecttoadd.TheobjectcanbeanotherCellStyle,aDataFormat,aAlignment,aBorder,aFill,aFont,oraCellProtectionobject.DetailsThestyleoftheargumentobjecttakesprecedenceoverthestyleofargumentcs1.ValueACellStyleobject.Author(s)AdrianDragulescuExamples##Notrun:cs-CellStyle(wb)+Font(wb,heightInPoints=20,isBold=TRUE,isItalic=TRUE,name=CourierNew,color=orange)+Fill(backgroundColor=lavender,foregroundColor=lavender,pattern=SOLID_FOREGROUND)+Alignment(h=ALIGN_RIGHT)setCellStyle(cell.1,cellStyle1)#youneedtosavetheworkbooknowifyouwanttoseethisart##End(Notrun)addDataFrame5addDataFrameAddadata.frametoasheet.DescriptionAddadata.frametoasheet,allowingfordifferentcolumnstyles.Usefulwhenconstructingthespreadsheetfromscratch.UsageaddDataFrame(x,sheet,col.names=TRUE,row.names=TRUE,startRow=1,startCo