在打印查询时,它只是打印“未定义”,但我需要从 excel 中获取的值进行打印。
this.getQuery = function(excelpath, sheetName, queryName) {
var query;
var workbook = new path.Workbook()
workbook.xlsx.readFile(excelpath)
.then(function(){
var sheet = workbook.getWorksheet(sheetName)
var rowsize=sheet.rowCount
for(i=1;i<rowsize;i++){
var Row = sheet.getRow(i)
var qName = Row.getCell(1).value
if(qName==queryName){
query=Row.getCell(2).value
break;
}
}
})
return query;
};