I wrote a script today to process a set of Excel workbooks. While I'll
eventually (Monday perhaps) have to deal with .xls, .xlsx, and .xlsm
formats, I'm focusing on the first today.
I wrote the script using one of the workbooks, and it seems to work as far
as I've taken it. Before adding more analysis, I figured I'd see if it
would read a second .xls file and process it successfully. (Eventually I
want to have it read an entire directory and put the worksheet data into a
rank 3 array.)
When I did, I get this result:
load 'fqfn.ijs'
readxlsheets: file not found
|index error: script
| headerrow=:headerrownum {ws t1
|[-61] fqfn.ijs
(I've replaced a long, boring script name with fqfn.ijs'.)
The index error is easy to understand, as the rank of t1 is 0 0, not 1 2.
While there are a few lines at the very start of the script that define a
few constants (directory and file names), the pertinent (actually, the
only non-comment) lines seem to be
require 'csv tables/tara grid parts scriptdoc files stats'
FN=: SOURCEDIR,FILE
t1=: (<'Actual Worksheet Name') readxlsheets FN
It's perplexing that
fexist FN
1
and yet from ~addons/tables/tara/tara.ijs, the start of readxlsheets is
readxlsheets=: 3 : 0
0 readxlsheets y
:
try.
'fln strng'=. 2{.!.(<0) boxopen y
x=. boxopen x
locs=. '' NB. store locales created
(msg=. 'file not found') assert fexist fln
When I step through readxlsheets, fexist fln returns 1, but still I get
the error.
FWIW, all of these Excel file names have spaces in them, but the only one
that works has a single quote in the middle, which I doubled to make the
string work.
Any clues? I know the various worksheets have slightly differing formats,
but I think I've accounted for that in my script. Mostly, though, this is
just reading the file, not accessing pieces of it or processing it
further.
Thanks,
Bill
PS: I did get this error earlier today when I was loading both tara and
taraxml. On the chance there was a name collision, I dropped the taraxml,
and things began to work. Now I wonder if there was a name collision or
if I switched test Excel files at the same time.
PPS: I've been using R a bit recently, too. While R has lots of nice
libraries, you have to type _so_ much to get the same things done you can
do with primitives in J! :-)
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm