[R] extract worksheet names from an Excel file

Gabor Grothendieck ggrothendieck at gmail.com
Fri Jun 24 14:02:30 CEST 2011


On Fri, Jun 24, 2011 at 12:41 AM, Shi, Tao <shidaxia at yahoo.com> wrote:
> Hi list,
>
> Is there a R function I can use to extract the worksheet names from an Excel file?  If no, any other automatic ways (not using R) to do this?
>
> thanks!
>

Many or all of the Excel interfaces listed here:

http://rwiki.sciviews.org/doku.php?id=tips:data-io:ms_windows&s=excel

can do that but be careful since one or more the packages listed there
always returns the sheet names sorted in alphabetical order which
means that you can't tell which is the first sheet, which is the
second, etc. (if that is important).

gdata has a specific function to do it:

library(gdata)
sheetNames("myfile.xls")

-- 
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com



More information about the R-help mailing list