خرید بک لینک

Vote count: 0

I am trying to get this function to run on a spreadsheet and find and replace all apostrophes with nothing. Right now it works but it takes too long, right now in my spreadsheet I have 12 rows and it took 128 seconds to run on just those. What I want to try and make this do is only activate on the last row in the spreadsheet.

I tried getting it to work by adding var row = r.getLastRow(); and changing a few spots to use row. I was not able to get it to run when I did that. I am going to have it run every time a form is submitted so it should always be the last row.

I got the code from: https://productforums.google.com/d/msg/docs/7IlOotksJ4I/liXa0SrC-R4J

function fandr() {
  var r=SpreadsheetApp.getActiveSheet().getDataRange();
  var rws=r.getNumRows();
  var cls=r.getNumColumns();
  var i,j,a,find,repl;
  find="'";
  repl="";
  for (i=1;i<=rws;i++) {
    for (j=1;j<=cls;j++) {
      a=r.getCell(i, j).getValue();
      if (r.getCell(i,j).getFormula()) {continue;}
      try {
        a=a.replace(find,repl);
        r.getCell(i, j).setValue(a);
      }
      catch (err) {continue;}
    }
  }
}

asked 38 secs ago

برچسب: نویسنده: استخدام کار تاريخ: دوشنبه 16 فروردين 1395 ساعت: 6:23

صفحه بندی