WPS 多维表格中的弹出窗口脚本

嗨,

我想请教一个技术问题。

请问在 多维表格 文件中,是否可以编写一个脚本来实现 弹出窗口(popup window) 的功能?

例如,我在 表格 类型的文件中成功实现了弹出窗口功能(可参考我附上的截图),使用的是 airscript 2.0,代码如下:

//

function getUserInputs() {

const product = prompt("Enter PRODUCT:");

if (product !== null) {

const po = prompt("Enter PO:");

if (po !== null) {

const qty = prompt("Enter QTY:");

if (qty !== null) {

insertDataIntoSheet(product, po, qty);

}

}

}

}

// insert data

function insertDataIntoSheet(product, po, qty) {

try {

const sheet = ActiveSheet;

console.log("Active sheet: " + sheet.Name); //

const usedRange = sheet.UsedRange;

const lastRow = usedRange.Rows.Count;

console.log("Last used row: " + lastRow); //

const nextRow = lastRow + 1;

console.log("Next row: " + nextRow); //

//

if (lastRow === 0) {

sheet.Cells(1, 1).Value2 = "PRODUCT";

sheet.Cells(1, 2).Value2 = "PO";

sheet.Cells(1, 3).Value2 = "QTY";

}

//

sheet.Cells(nextRow, 1).Value2 = product;

sheet.Cells(nextRow, 2).Value2 = po;

sheet.Cells(nextRow, 3).Value2 = qty;

console.log(`Data inserted at row ${nextRow}: PRODUCT=${product}, PO=${po}, QTY=${qty}`); //

} catch (error) {

console.error("Error inserting data: " + error.message); //

}

}

//

getUserInputs();

目前,我了解到 多维表格 仅支持 airscript 1.0,

因此我想确认:

是否可以在该版本中实现类似的弹出窗口功能?或者是否有其他可行的替代方案?

如果您或其他用户已经尝试过并成功实现,希望能给予我一些指导。

非常感谢您的时间和帮助!

期待您的回复。

纽约
浏览 215
收藏
2
分享
2 +1
3
+1
全部评论 3
 
秋寒
期待官方推出。
· 广东省
回复
 
江浩
这个需求很实用,期待官方退出。
· 浙江省
1
回复
 
WPS_1759231330
谢谢分享
· 广东省
回复