Hey, I'm trying to make a very very simple google script to try some stuff 
out but I don't understand why it isn't working because the error it gives 
me in my email shouldn't even be happening. 
Here the error:

Details:
Start  FunctionError MessageTriggerEnd8/9/14 12:53 AM convertToDate  
TypeError: Cannot find function search in object [object Object]. (line 28, 
file "Code") edit8/9/14 12:53 AM
Here my code:

function myFunction() {
>   
> }
>
> function onEdit(e) {
>   var firstTime = "Not Entered";
>   var secondTime = "Not Entered";
>   var doc = SpreadsheetApp.getActiveSheet();
>   var r = e.source.getActiveRange();
>   var currentCol = r.getColumn();
>   var currentRow = r.getRow();
>   var cellData = r.getValue()
>   var ui = SpreadsheetApp.getUi()
>   if(cellData.indexOf("-") > -1) {
>     var dateSplit = cellData.split("-");
>     firstTime = convertToDate(dateSplit[0]);
>     secondTime = convertToDate(dateSplit[1]);
>     ui.alert(firstTime);
>   }
>   
> ui.alert(currentCol+":"+currentRow+":"+cellData+":"+firstTime+":"+secondTime);
>   var dateCell = doc.getRange(2, currentCol);
>   dateCell = dateCell.getCell(1,1);
>   ui.alert(dateCell.getValue());
>
> }
>
> function convertToDate(x) {
>   if(x.search("AM") > -1) {
>     x = x.replace("AM","");
>     x = parseInt(x);
>   }
>   else if(x.search("PM") > -1) {
>     x = x.replace("PM","");
>     x = parseInt(x)+parseInt(12);
>   }
>   else {
>    x = "Invalid Format!"; 
>   }
>   return x;
>   
> }
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Spreadsheets API" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to