VLookup on Javascript #2

    0

    3

    Guntar Susatyo

    The code first opens the spreadsheet with the ID '1pEGVc2q32yRCYhPxcl_xHwBfoI_ApgizkpX_4ngorzg' and then iterates through the data in the 'PO' sheet. For each value in the data range D:D, it checks to see if the value in column B is the same as the code dataKodePOD. If it is, the function returns the value of i+1. If the values in column B are not the same, the function logs a message to the logger and returns the value of i+1.

    Shortcut: sheetVLookUp_02

    function barisDataPO(dataKodePOD) {
      const sheetDataPO = SpreadsheetApp.openById('1pEGVc2q32yRCYhPxcl_xHwBfoI_ApgizkpX_4ngorzg').getSheetByName('PO');
      const dataDicari = sheetDataPO.getDataRange('D:D').getValues();
      for(var i = 0; i < dataDicari.length;i++){
        if(dataDicari[i][0] === dataKodePOD){ //[1] because column B
          Logger.log((i+1) + ' ketemu baris ke-nya !')
          return i+1;
        }
      }
    }
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Playground
    • Snippets
    • Cookbooks
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.