syrvn
2011-Jul-13 09:46 UTC
[R] Error when writing to Excel files using the packages xlsx and xlsx2
Dear group, I am working on a rather big project where the output data frames have dimensions of 3000 x 15 or greater. We are using xlsx and xlsx2 to write the data.frames to Excel sheets. Since recently we get the following error, when trying to write the data frames to the excel sheets: Error in ls(envir = envir, all.names = private) : invalid 'envir' argument We figured out that the error occurs when the excel sheet is open while R tries to write to it. But now, closing all open excel sheets does not fix the error any longer. We also tried deleting the excel sheet in case it might be corrupt but we still get the same error. We have a very narrow timeframe so any help on how to fix that error is very much appreciated. Best regards, Flo -- View this message in context: http://r.789695.n4.nabble.com/Error-when-writing-to-Excel-files-using-the-packages-xlsx-and-xlsx2-tp3664617p3664617.html Sent from the R help mailing list archive at Nabble.com.
Denis Kazakiewicz
2011-Jul-13 09:53 UTC
[R] Error when writing to Excel files using the packages xlsx and xlsx2
The most safe way work with excel is through .csv format Sorry for being nonspecific On 13.07.2011 12:46, syrvn wrote:> Dear group, > > I am working on a rather big project where the output data frames have > dimensions of 3000 x 15 or greater. We are using xlsx and xlsx2 to write the > data.frames to Excel sheets. > > Since recently we get the following error, when trying to write the data > frames to the excel sheets: > > Error in ls(envir = envir, all.names = private) : > invalid 'envir' argument > > We figured out that the error occurs when the excel sheet is open while R > tries to write to it. > But now, closing all open excel sheets does not fix the error any longer. We > also tried deleting the excel sheet in case it might be corrupt but we still > get the same error. > > We have a very narrow timeframe so any help on how to fix that error is very > much appreciated. > > Best regards, > Flo > > -- > View this message in context: http://r.789695.n4.nabble.com/Error-when-writing-to-Excel-files-using-the-packages-xlsx-and-xlsx2-tp3664617p3664617.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help at 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.
Denis Kazakiewicz
2011-Jul-13 09:56 UTC
[R] Error when writing to Excel files using the packages xlsx and xlsx2
write.csv(mydata, file="mydataExported.csv", na="") On 13.07.2011 12:46, syrvn wrote:> Dear group, > > I am working on a rather big project where the output data frames have > dimensions of 3000 x 15 or greater. We are using xlsx and xlsx2 to write the > data.frames to Excel sheets. > > Since recently we get the following error, when trying to write the data > frames to the excel sheets: > > Error in ls(envir = envir, all.names = private) : > invalid 'envir' argument > > We figured out that the error occurs when the excel sheet is open while R > tries to write to it. > But now, closing all open excel sheets does not fix the error any longer. We > also tried deleting the excel sheet in case it might be corrupt but we still > get the same error. > > We have a very narrow timeframe so any help on how to fix that error is very > much appreciated. > > Best regards, > Flo > > -- > View this message in context: http://r.789695.n4.nabble.com/Error-when-writing-to-Excel-files-using-the-packages-xlsx-and-xlsx2-tp3664617p3664617.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help at 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.
syrvn
2011-Jul-13 09:58 UTC
[R] Error when writing to Excel files using the packages xlsx and xlsx2
Hi Denis, are you saying that we should write the R output (data frame) to a .csv file and then import it manually into Excel? Thanks Flo -- View this message in context: http://r.789695.n4.nabble.com/Error-when-writing-to-Excel-files-using-the-packages-xlsx-and-xlsx2-tp3664617p3664639.html Sent from the R help mailing list archive at Nabble.com.
Gabor Grothendieck
2011-Jul-13 10:54 UTC
[R] Error when writing to Excel files using the packages xlsx and xlsx2
On Wed, Jul 13, 2011 at 5:46 AM, syrvn <mentor_ at gmx.net> wrote:> Dear group, > > I am working on a rather big project where the output data frames have > dimensions of 3000 x 15 or greater. We are using xlsx and xlsx2 to write the > data.frames to Excel sheets. > > Since recently we get the following error, when trying to write the data > frames to the excel sheets: > > Error in ls(envir = envir, all.names = private) : > ?invalid 'envir' argument > > We figured out that the error occurs when the excel sheet is open while R > tries to write to it. > But now, closing all open excel sheets does not fix the error any longer. We > also tried deleting the excel sheet in case it might be corrupt but we still > get the same error. > > We have a very narrow timeframe so any help on how to fix that error is very > much appreciated. >There are quite a few approaches listed here: http://rwiki.sciviews.org/doku.php?id=tips:data-io:ms_windows -- Statistics & Software Consulting GKX Group, GKX Associates Inc. tel: 1-877-GKX-GROUP email: ggrothendieck at gmail.com
syrvn
2011-Jul-13 13:14 UTC
[R] Error when writing to Excel files using the packages xlsx and xlsx2
Hi, thanks for this web page! We decided to go for XLConnect because it can read and write xlsx sheets. With that package we get the same error message (see above) as with the xlsx package. After that error we even end up with a corrupted excel spread sheet. We are not able to open it any longer. Because both packages use java as an interface we may conclude it is not an error in the package itself but with java. Any other advices? Many thanks, Flo -- View this message in context: http://r.789695.n4.nabble.com/Error-when-writing-to-Excel-files-using-the-packages-xlsx-and-xlsx2-tp3664617p3664981.html Sent from the R help mailing list archive at Nabble.com.
David Winsemius
2011-Jul-13 15:49 UTC
[R] Error when writing to Excel files using the packages xlsx and xlsx2
On Jul 13, 2011, at 9:14 AM, syrvn wrote:> Hi, > > thanks for this web page!Grothendieck had offered: ----- There are quite a few approaches listed here: http://rwiki.sciviews.org/doku.php?id=tips:data-io:ms_windows -----> > We decided to go for XLConnect because it can read and write xlsx > sheets. > With that package we get the same error message (see above) as with > the xlsx > package.There is no "above" in you current message. Most of us are _not_ using Nabble to read r-help postings.> > After that error we even end up with a corrupted excel spread sheet. > We are > not able > to open it any longer. > > Because both packages use java as an interface we may conclude it is > not an > error in > the package itself but with java. > > Any other advices?Surely using two packages does not exhaust the advice on that page. (... which you did not provide as context ... what fraction of Nabble users _ever_ read the Posting Guide?) In particular: The xls.write function in gdata uses Perl.>David Winsemius, MD West Hartford, CT
David Winsemius
2011-Jul-13 16:12 UTC
[R] Error when writing to Excel files using the packages xlsx and xlsx2
On Jul 13, 2011, at 11:49 AM, David Winsemius wrote:> > > > In particular: The xls.write function in gdata uses Perl.Wrong name.... I was thinking of read.xls in gdata.>David Winsemius, MD West Hartford, CT