The following function call fails when I invoke it in a fresh Mathematica session:
z1 = Import["Hydrogen Z1.xlsx",
Path -> "F:\\Mathematica Projects\\NIST x-ray attenuation data"][[1]]
The path exists and the Excel file exists in that path, but I get the following errors when I invoke the function:
Get::noopen: Cannot open JLink`. >>
Needs::nocont: Context JLink` was not created when Needs was evaluated. >>
Part::partd: Part specification Null[[1]] is longer than depth of object. >>
Part::partd: Part specification Null[[1]] is longer than depth of object. >>
The result returned is Null[1]
On the other hand, if I invoke the Import
function to try to fetch data from a web page using the following command, I get no errors:
Import["http://physics.nist.gov/PhysRefData/XrayMassCoef/ElemTab/z56.html", "Data"]
Unfortunately, there are some problems with the way the data is formatted (which is why I downloaded the data into the Excel files in the first place). Strangely, after using Import to fetch data from the web, the original function call to Import to read the Excel files works just fine without error. This leads me to believe that the failure of the first command occurs because some package is needed but not loaded by default and Import is smart enough to load this package when fetching data from the web but not when attempting to read Excel file data locally. So, presumably a Needs
statement is needed. What package do I need to load to make this work on the first try (if that is indeed the problem)? Or is the problem something else altogether?
Import["cities.xlsx",Path->"C:\\Program Files\\Wolfram Research\\Mathematica\\8.0\\Documentation\\English\\System\\ExampleData"]
. $\endgroup$Needs["JLink`"]
beforeImport
ing. $\endgroup$Import[FileNameJoin[{"F:\\Mathematica Projects\\NIST x-ray attenuation data","Hydrogen Z1.xlsx"}]][[1]]
. $\endgroup$