Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: import excel - requiring restart occasionally

From   Billy Schwartz <>
Subject   Re: st: import excel - requiring restart occasionally
Date   Thu, 3 Nov 2011 16:25:25 -0400

Thanks! Just out of curiosity: I noticed that import excel is
implemented in Mata -- will that source code be made public?

On Thu, Nov 3, 2011 at 4:01 PM, Kevin Crow, StataCorp LP
<> wrote:
> Billy Schwartz <> wrote :
> >"describe" eventually lead to increasing numbers of error 603's when
> >running the import command. Restarting Stata seems to fix it.
> >Facts: I have 947 Excel workbooks, both .xls and .xlsx, averaging just under 3
> >sheets per book, and I have to organize them. As a first step I've written a
> >Stata script to create a table of the sheet names in each workbook. It loops
> >through the *.xls* file names in my folder and runs "import excel, describe" on
> >each, putting the contents returned in r() into a data set that accumulates. I
> >open up Stata and run the script, and it works as intended with 14 error 603s,
> >which I catch and handle. (So you don't have to look it up, error 603 means the
> >file could not be opened even though it was found. I don't know why these error
> >603's occur since Excel opens the file just fine, but I'm comfortable with a 1%
> >error rate.) During the debugging process, I've had to run the script
> >repeatedly in a given instance of Stata. After three to five runs, the number
> >of error 603's I get goes from 14 to a couple hundred....
> This is a bug in -import excel-.  It will be fixed in the next executable
> update.
> -import excel- was not cleaning up file-handle bookkeeping if the
> command exited when trying to open a workbook.  -import excel- has a
> maximum of 50 open workbooks at one time.  Because of the bug, Stata
> could not open any more workbooks after 50 errors because it thought
> there were 50 open file handles.  This would cause Stata to error every
> time you tried to open a workbook.  Until we release the update, the
> open workbook counter may be reset by re-starting Stata.
> -Kevin Crow
> *
> *   For searches and help try:
> *
> *
> *

*   For searches and help try:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index