Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | kcrow@stata.com (Kevin Crow, StataCorp LP) |
To | "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu> |
Subject | Re: st: Trouble importing an Excel spreadsheet when the desired sheet is not the first sheet |
Date | Thu, 01 Nov 2012 15:58:40 -0500 |
Aaron Kirkman <ak1795mailserv@gmail.com> wrote: >Dear Statalist, > > I'm using Stata 12.1 with the 22 Oct 2012 revision on Windows 7 x64. I > need to import data from an excel spreadsheet where the desired sheet > is not the first sheet, but the --import excel-- command returns an > r(601) error of "Sheet not found." > > The spreadsheet contains data from the Workforce Investment Act, found > at this link: > > http://www.doleta.gov/budget/docs/110630_wia_spendsum_bypgm_asof_120209_out.xls > > The sheet I need is titled "DW_Sum". I ran this command: > > **** > import excel "110630_wia_spendsum_bypgm_asof_120209_out.xls", > sheet("DW_Sum") clear > **** > > but I get the r(601) error. If I open Excel and move the DW_Sum sheet > to a position as the first sheet, the above command works. The same > command also works if I remove the --sheet-- option all together > (assuming I've moved DW_Sum to be the first sheet). > > Can anyone reproduce this error? In other spreadsheets from the site, > i.e. this one: > > http://www.doleta.gov/budget/docs/101231_WIA_SpendSum_byPgm_asof_110603_OUT.xls > > I do not have this problem, so I assume this is a problem with this > specific spreadsheet, but I want to make sure. > > Thank you, > Aaron We believe there is somthing wrong with the Excel file in question. If Aaron opens the file in Excel and resaves it, even without making any changes to it, -import excel- will be able to import it into Stata. For more help, Aaron can contact tech-support@stata.com. Kevin Crow StataCorp * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/faqs/resources/statalist-faq/ * http://www.ats.ucla.edu/stat/stata/