感谢aardio培训群:Kylin 分享源码
xlsx格式的excel文件是对xml的封包, 所以可以用string.xml库来处理这种格式文件的数据
下面是他提供的简单数字数据读取示例库excelx://excel_数字数据简单读取
import string.xml;
import zlib.zip
import zlib.unzip
import fsys;
import console;
class excelx{
ctor (xlsx, n=1) {
if xlsx and ..io.exist(..io.fullpath(xlsx)) {
..fsys.copy(..io.fullpath(xlsx),"~/temp.zip");
..zlib.unzip.extract( "~/temp.zip","~/tmp",
function(fileName,extractPath,fileInfo,size,unitSize,unitName){
if(extractPath){
return true;
}
}, , function(numEntries){}
)
try{
this = ..string.xml(..string.load("~/tmp/xl/worksheets/sheet"++n++".xml"))
this.data = this.