Reputation: 105
I have been trying to run this code on Google scripts but running into the following error - Illegal character. (line 5, file "Code"). The code is below. Any help is truly appreciated.
Thanks!
function myFunction() {
var d = new Date();
var hours = d.getHours();
var currentTime = d.toLocaleDateString();
var counter = SpreadsheetApp.getActiveSheet().getRange(‘B1’).getValues();
if (hours >= 6 && hours <= 18) {
var response = UrlFetchApp.fetch(“https://recipe-qoo-api.herokuapp.com/");
SpreadsheetApp.getActiveSheet().getRange(‘A’ + counter).setValue(‘Visted at ‘ + currentTime + “ “ + hours + “h”);
SpreadsheetApp.getActiveSheet().getRange(‘B1’).setValue(Number(counter) + 1);
}
}
Upvotes: 1
Views: 366
Reputation: 5616
Looks like the character used for the single inverted quote is incorrect.
It should be like 'B1' instead of ‘B1’.
Upvotes: 1