Reputation: 1
I used the following function to iterate CONCATENATE in the spreadsheets. However, it shows the following error
Missing; before statement. (line 11, file "Code").
function iterate()
{
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getSheets()[0];
var startRow = 2;
var lastRow = sheet.getLastRow();
for (var i = startRow; i <= lastRow; i++)
{
var result(i) = =CONCATENATE("http://cdn.staticmb.com/mbphoto/property/original_images/",A(i), "/ ",E(i), "/" ,C(i),"/",D(i)) ;
var range = sheet.getRange("F2,F15");
range.setValues(result(i));
}
}
Upvotes: 0
Views: 1947
Reputation: 19835
Besides several javascript syntax errors like those pointed out in comments, the biggest issue is that you are trying to use "=CONCATENATE" in javascript. Its not a javascript function, none of the sheet cell formulas are, those can only be used inside sheet cells. You need to code the concatenation using javascript functions or operators like var a= b + "x" + d
. That cleared out it should be easy to code it or google for it. You are also using result(i)
where apparently you want to use an array. Look up the correct syntax for creating and adding elements to an array in javascript.
Upvotes: 1