我對自己所知甚少印象深刻,經過幾個小時的嘗試,我不得不求助于你。
我認為這個程序應該如下: 在陣列中定義關鍵字;遍歷范圍;找到關鍵字后,它開始計數,直到找到下一個關鍵字;Counter 成為該類別的行數;它從找到的下一個關鍵字重新開始。
我開始寫它,但我在這里看不到多個 for 回圈,我想知道它還會是什么:
function formatCells() {
//Utilities.sleep(3000);
//Formats Categories and cell colors
const ss = SpreadsheetApp.getActiveSpreadsheet();
const boqPipeworkSheet = ss.getSheetByName('BOQ Pipework');
const boqPipeworkRng = boqPipeworkSheet.getRange(5, 1, boqPipeworkSheet.getLastRow(), 14);
const boqPipeworkValues = boqPipeworkRng.getValues();
let categoryToPaste = [];
let categories = ['Copper pipework'];
let counter = 0;
for (let r = 0; r < boqPipeworkRng.length; r ) {
let category = boqPipeworkRng[r][0];
if (categories.indexOf(category) > -1) {
categoryToPaste.push(category);
counter
}
}
}
資料如下:

這是包含示例的檔案的鏈接:
轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/404505.html
標籤:
