json - Excel 脚本超时错误 - 可能的 JSON 问题?
问题描述
我有一个脚本设置可以在流程中自动运行。但是,我注意到如果循环超过 4,000 行,脚本就会出错。
我最初并没有创建脚本,所以我试图维护它并扩展它可以处理的行数。它基本上是复制和循环多行。这是脚本:
"function main(workbook: ExcelScript.Workbook, rangeTest: string)
{
let newSheet = workbook.getWorksheet("Main Table")
let tableName = newSheet.getTable("MainTable");
let col1;
let col2;
let col3;
let col4;
let col5;
let col6;
let col7;
let col8;
let col9;
let col10;
let col11;
let col12;
let col13;
let col14;
let str = rangeTest;
let testerTest = JSON.parse(str);
console.log(testerTest.length);
for (let i = 1; i < testerTest.length; i++) {
col1 = testerTest[i][1]; //Col A
col2 = testerTest[i][2]; //Col B
col3 = testerTest[i][15]; //Col C
col4 = testerTest[i][4]; //Col D
col5 = testerTest[i][5]; //Col E
col6 = testerTest[i][13]; //Col F
col7 = testerTest[i][10]; //Col G
col8 = testerTest[i][6]; //Col H
col9 = testerTest[i][7]; //Col I
col10 = testerTest[i][19]; //Col J
col11 = testerTest[i][8]; //Col K
col12 = testerTest[i][9]; //Col L
col13 = testerTest[i][11]; //Col M
col14 = testerTest[i][12]; //Col N
tableName.addRow(null, [col1, col2, col3, col4, col5, col6, col7, col8, col9, col10, col11, col12, col13, col14]);
}
}"
上面的两个图像显示了当流/脚本在超过 4000 行时失败以及当流/脚本在 4000 行以下成功时收到的消息。
有什么方法可以修改脚本、流程、JSON 或任何东西以允许该脚本在超过 4000 行的文件上运行?
解决方案
推荐阅读
- file - 我想复制此文件,但无法在终端中正确输入
- javascript - 用多维数组制作下拉菜单
- mongodb - mongodb 查询嵌套 $or 在“AND”内
- javascript - 有没有办法让 Highstock Scrollbar 响应触控板?
- excel - 根据特定列中的值将行复制到 wksheet 不适用于我的整个电子表格
- c# - 使Entity Framework生成的实体实现接口
- python - 使用正则表达式删除括号中任何内容的多次出现
- excel - 粘贴到第一个工作表时自动将图像粘贴到第二个工作表中
- gradle-kotlin-dsl - 如何将根 build.gradle 中的 Gradle Groovy 方法转换为 build.gradle.kts 中的 Gradle Kotlin DSL 函数
- javascript - 希望将 jquery 变量从表单更新为函数