On 27/04/2012 12:08 PM, Ben quant wrote:
Hello again,

I'd like to determine if an Excel file is open or writable. Can anyone help
me with that?
Try to write to it. If you fail, it wasn't writable. (You can wrap your attempt in try() so that it doesn't abort your program.)

If you're not ready to write to it, then open it as a connection in write mode. I think that will also fail if it's not writable. You have to keep it open until you're finished writing; otherwise some other process could grab it after your test but before you write.

Duncan Murdoch

I write some stats to an .xlsx Excel file using the xlsx package. I can't
write to the file unless its closed. How do I determine if the .xlsx file
is open or closed so I can write to it?

I've looked at file.info and file.access and I couldn't get those to work
for me.

Any help would be great!
ben

        [[alternative HTML version deleted]]

______________________________________________
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.

______________________________________________
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.

Reply via email to