Re: Export into Excel Worksheets
- To: mathgroup at smc.vnet.net
- Subject: [mg90880] Re: Export into Excel Worksheets
- From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
- Date: Mon, 28 Jul 2008 07:51:18 -0400 (EDT)
- Organization: The Open University, Milton Keynes, UK
- References: <g6h5f1$h1t$1@smc.vnet.net>
Tugrul Temel wrote: > Yes, the following code works in exporting data from Mathematica to Excel > file > > data = RandomReal[{0, 1}, {3, 4, 2}]; > Export["test.xls", data]; > > However, in importing the same file "test.xls" back to Mathematica, the > following code does not work. WHY? > > data1 = Import["D:\test.xls", {"Data", 1}] > data2 = Import["D:\test.xls", {"Data", 2}] > data3 = Import["D:\test.xls", {"Data", 3}] <snip> It is very likely that you are not reading the file you have just created: the exported file "test.xls" is located in $HomeDirectory whereas "D:\test.xls" is located on the root level of the second drive/partition. In[1]:= data = RandomReal[{0, 1}, {3, 4, 2}] Export["test.xls", data] Out[1]= {{{0.902338, 0.905259}, {0.992485, 0.820032}, {0.324872, 0.880122}, {0.713961, 0.625327}}, {{0.157472, 0.849435}, {0.947472, 0.976526}, {0.834299, 0.528255}, {0.994454, 0.807406}}, {{0.61929, 0.253483}, {0.695069, 0.76067}, {0.635693, 0.0609954}, {0.761752, 0.608448}}} Out[2]= "test.xls" In[3]:= data1 = Import["test.xls", {"Data", 1}] data2 = Import["test.xls", {"Data", 2}] data3 = Import["test.xls", {"Data", 3}] Out[3]= {{0.902338, 0.905259}, {0.992485, 0.820032}, {0.324872, 0.880122}, {0.713961, 0.625327}} Out[4]= {{0.157472, 0.849435}, {0.947472, 0.976526}, {0.834299, 0.528255}, {0.994454, 0.807406}} Out[5]= {{0.61929, 0.253483}, {0.695069, 0.76067}, {0.635693, 0.0609954}, {0.761752, 0.608448}} Regards, -- Jean-Marc