Also update the URL to the CeCILL license. Thanks to Paul for noticing that
[scilab.git] / scilab / modules / spreadsheet / macros / readxls.sci
1
2 // Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3 // Copyright (C) 2005-2008 - INRIA - Serge STEER <serge.steer@inria.fr>
4 // Copyright (C) 2005- INRIA - Pierrick Mode
5 //
6 // This file must be used under the terms of the CeCILL.
7 // This source file is licensed as described in the file COPYING, which
8 // you should have received as part of this distribution.  The terms
9 // are also available at
10 // http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
11
12 function sheets=readxls(fil)
13     if argn(2)==1 then opt=1,end
14     fil=pathconvert(fil,%f,%t)
15     sheets=mlist(["xls","sheets"],list())
16     [fd,Text,Sheetnames,Abspos]=xls_open(fil)
17     Text=["", Text];
18     for k=1:size(Abspos,"*")
19         [Value,TextInd]=xls_read(fd,Abspos(k))
20         if Value==[] then
21             sheet=mlist(["xlssheet","name","text","value"],Sheetnames(k),[],Value)
22         else
23             if size(Text,"*")==1 then
24                 T=emptystr(Value)
25             else
26                 T=matrix(Text(TextInd+1),size(Value))
27             end
28             sheet=mlist(["xlssheet","name","text","value"],Sheetnames(k),T,Value)
29         end
30         sheets.sheets($+1)= sheet
31     end
32     mclose(fd)
33 endfunction