title: What's wrong with my Google Docs script for multiple search and replace (replace table)
body: <p>I was trying to use a Google Docs script for a multiple search &amp; replace. The idea is that words in a given column are replaced with words specified in a 'replace table', possibly consisting of two different columns in the very same, opened spreadsheet. I post the code below. The script runs fine (without errors). The only problem is - absolutely nothing changes, the words are not replaced. What's wrong?</p>
  
  <pre><code>function replMyText() {
      var ss=SpreadsheetApp.getActive();
      var sh=ss.getSheetByName('Lista');
      var rgtxt=sh.getRange('B1:B17'); //text to replace
      var rgrep=sh.getRange('C1:D2'); //replacement table
      var txtA=rgtxt.getValues();
      var repA=rgrep.getValues();
      for(var i=0; i&lt;txtA.length; i++) {
          for(var j=0; j&lt;repA.length; j++) {
              if(txtA[i][0]==repA[j][0]) {
                  txtA[i][0]=repA[j][1];
              }
          }
      }
      rgtxt.setValues(txtA);
  }
  </code></pre>