Excel API 1.1 - 向 table 添加内容时出错

Excel API 1.1 - error while adding content to table

我正在尝试为 Excel 创建一个 ``Office add-in`` 但遇到以下问题。 这发生在更新服务器后。

设置:

代码:

export async function run() {
  try {
    Excel.run(function (context) {
      //var sheet = context.workbook.worksheets.getItem("Sample");
      var sheet = context.workbook.worksheets.getActiveWorksheet();
      var expensesTable = sheet.tables.add("A1:D1", true /*hasHeaders*/);
      expensesTable.name = "ExpensesTable";
  
      expensesTable.getHeaderRowRange().values = [["Date", "Merchant", "Category", "Amount"]];
  
      expensesTable.rows.add(null /*add rows to the end of the table*/, [
        ["1/1/2017", "The Phone Company", "Communications", "0"],
        ["1/2/2017", "Northwind Electric Cars", "Transportation", "2"],
        ["1/5/2017", "Best For You Organics Company", "Groceries", ""],
        ["1/10/2017", "Coho Vineyard", "Restaurant", ""],
        ["1/11/2017", "Bellows College", "Education", "0"],
        ["1/15/2017", "Trey Research", "Other", "5"],
        ["1/15/2017", "Best For You Organics Company", "Groceries", ""]
      ]);
  
      sheet.activate();
  
      return context.sync();
    })
    .catch(function (error) {
      console.log("Error: " + error);
      if (error instanceof OfficeExtension.Error) {
        console.log("Debug info: " + JSON.stringify(error.debugInfo));
      }
    });
  } catch (error) {
    console.error(error);
  }
}

结果:

Error: InvalidArgument: The argument is invalid or missing or has an incorrect format.
Debug info: {"code":"InvalidArgument","message":"The argument is invalid or missing or has an incorrect format.","errorLocation":"TableRowCollection.add"}

添加一个额外的参数作为第一个参数对我有用

expensesTable.rows.add(null,null, [["1/1/2017", "The Phone Company", "Communications", "0"]])