如何向以下代码添加异步等待?我想传递以下参数“ numOfParts”,然后使用VLOOKUP Excel内置函数从工作簿范围中找出什么finalInspectionPerPart。
/**
* Inspection (Minutes)
* @customfunction inspectionMins
* @param {number} numOfParts
* @returns {number} inspectionMins
*/
function inspectionMins(numOfParts) {
var finalInspectionPerPart;
var procEff = 0.72;
Excel.run(function (context) {
var range = context.workbook.worksheets.getItem("Sheet1").getRange("A1:B9");
var finalInspectionPerPart = context.workbook.functions.vlookup(numOfParts, range, 2, false);
finalInspectionPerPart.load('value');
return context.sync()
.then(function () {
});
}).catch(errorHandlerFunction);
return (finalInspectionPerPart / procEff);
}