我正在尝试为 Google Docs 电子表格编写一个简单的脚本。下面的两个链接是我正在为其编写脚本的工作表的屏幕截图。
http://i.stack.imgur.com/uGik7.png
http://i.stack.imgur.com/AbKnQ.png
在工作表采购订单上,如果列 e ==“库存”,那么我需要它来查找零件号并调整工作表“库存”中的数量。贝娄是我正在尝试做的事情的开始。谁能帮我一把?
function updateInventoryFromPurchaseOrders() {
var purchaseOrders = {}; // A mapping of partNumber => quantity.
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getSheetByName('Purchase Orders');
if (sheet) {
// For each row, if column "E" == "stock" then set partNumber, quantity.
purchaseOrders[partNumber] = quantity;
}
// Now purchaseOrders should look like {'SL249':5, 'ML50':1, 'MWF':1}
sheet = ss.getSheetByName('Inventory');
if (sheet) {
// For each row, set quantity, partNumber.
var purchased = purchaseOrders[partNumber];
// Set column "A" value = quantity + purchased
}
}
谢谢您的帮助。