You perhaps missed the key point in Uwe's response, which is that the package is only available under Windows, as it depends upon Windows specific functionality (MS Office API via a third party library which is available for Windows only) to natively read and write Excel files. Thus, there is no package version available for Linux, or OSX for that matter.
If you need to read Excel files under Linux, you could look at the read.xls() function in the 'gdata' CRAN package. This package requires that Perl be installed, as it calls a Perl routine (xls2csv) for converting the Excel file to a CSV file, which can then be read into R. If you need to write Excel files under Linux, you can use a Perl routine that I had posted back in 2007: https://stat.ethz.ch/pipermail/r-help/2007-July/135968.html and have updated since then to handle Unicode issues. I am attaching a 2k text file here with the updated routine. HTH, Marc Schwartz on 03/03/2009 06:38 AM reverend33 wrote: > I'm sorry, maybe i didn't explain clearly: i'm trying to install xlsReadWrite > on a Linux-type OS (Ubuntu)... > > > > > > Uwe Ligges-3 wrote: >> >> >> reverend33 wrote: >>> Hi, >>> >>> I'm trying to install R on Ubuntu. >>> I succeeded at installing the r-recommended package that is present in >>> the >>> synaptics, but i can't find the xlsReadWrite package in the repositories >>> included in my synaptics manager. >>> Does anybody know a liable repository in which this package is present. >> If you consider the CRAN master to be liable, it tells you for >> xlsReadWrite: >> >> OS_type: windows >> >> Moreover it tells you that the package's status for R-devel is "ERROR". >> >> >> Uwe Ligges
#!/usr/bin/perl -w # Called as: WriteXLS.pl [--CSVpath] [--CSVfiles] ExcelFileName # Spreadsheet::WriteExcel # http://search.cpan.org/~jmcnamara/Spreadsheet-WriteExcel/lib/Spreadsheet/WriteExcel.pm # Excel 2007specifications and limitations # http://office.microsoft.com/en-us/excel/HP100738491033.aspx # For unicode issues: # http://www.ahinea.com/en/tech/perl-unicode-struggle.html use strict; use Spreadsheet::WriteExcel; use Getopt::Long; use File::Glob; use File::Basename; use Text::CSV_XS; use Encode; # Initialize and get command line arguments my $CSVPath = '.'; my $CSVFiles = "*.csv"; GetOptions ('CSVpath=s' => \$CSVPath, 'CSVfiles=s' => \$CSVFiles); my $ExcelFileName = $ARGV[0]; # Create Excel XLS File print "Creating Excel File: $ExcelFileName\n\n"; my $XLSFile = Spreadsheet::WriteExcel->new($ExcelFileName); # Glob file path and names my @FileNames = <$CSVPath/$CSVFiles>; foreach my $FileName (@FileNames) { print "Reading: $FileName\n"; # Open CSV File my $csv = Text::CSV_XS->new ({ binary => 1 }); open (CSVFILE, "$FileName") || die "ERROR: cannot open $FileName. $!\n"; # Create new sheet with filename prefix # ($base, $dir, $ext) = fileparse ($FileName, '..*'); my $FName = (fileparse ($FileName, '\..*'))[0]; # Only take the first 31 chars, which is the # limit for a worksheet name my $SheetName = substr($FName, 0, 31); print "Creating New WorkSheet: $SheetName\n\n"; my $WorkSheet = $XLSFile->add_worksheet($SheetName); # Rows and columns are zero indexed my $Row = 0; # Write to Sheet while (<CSVFILE>) { if ($csv->parse($_)) { my @Fields = $csv->fields(); my $Col = 0; foreach my $Fld (@Fields) { $WorkSheet->write($Row, $Col, decode_utf8($Fld)); $Col++; } $Row++; } } close CSVFILE; }
______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.