【问题标题】:Read excel and populate 2 dimensional array in typescript读取 excel 并在 typescript 中填充二维数组
【发布时间】:2021-05-24 04:06:30
【问题描述】:

我想在 Excel 工作表中读取一个简单的表格(x 行,y 列)并在 typescript 中填充一个二维数组。如下所示:

client_id orderid
1 : 12 3 45 78 97
2 : 67 89 12
3 : 7 90 23

你知道一个好的excel库吗?谢谢

问候, 蒂蒂

【问题讨论】:

    标签: arrays excel typescript multidimensional-array


    【解决方案1】:

    您只需指定表名,然后可以使用getRange().getValues() 将表中的值捕获为 2 天数组。示例:

    function main(workbook: ExcelScript.Workbook) {
     const theTableName:string = "table1"; // or whatever the name is
     var theTable = workbook.getTable(theTableName);
     var allValues = theTable.getRange().getValues();
     // allVallues is now an 2-day array with values
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-03-22
      • 2016-05-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多