Take the 2-minute tour ×
Web Applications Stack Exchange is a question and answer site for power users of web applications. It's 100% free, no registration required.

I have a Google Apps Script which I want to use to do this: get the text of all cells of column G of my sheet, extract some data from this text (dates embebed in text) and put the result in the column H. I can extract the date from the raw text. But I cann't iterate and put it in the neighbur column ("H"), because, when I try this with this code, nothing happens. And I got this logs:

enter image description here

This is my code:

function changeNextCell() {
  var range = SpreadsheetApp.getActiveSheet().getActiveRange();
  var numRows = range.getNumRows();
  for (var i = 2; i <= numRows; i++) {
      var rawText = range.getCell(i,6).getValue();
      var newDate = findDate(rawText);
      range.getCell(i,6).setValue(newDate);
    }  
}


function findDate (text){
  text1 = text.split("Date:");
date = 'no date informed';
for (var i=0; i<text1.length; i++) {
     text2 = text1[i].split(" ");
     if (text2[1] === 'open:'){
         date = text2[2];
     }
  }
  return date;
}

Can someone tell me what to fix to it work as it should do? (replace all values in next column) THANKS in advance for any help!

share|improve this question
    
Could you please include a sample spreadsheet link for us to look at? –  Tom Horwood Nov 6 '13 at 0:23
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.