I’m having a bit of trouble removing commas from an array when I go to write it to a cell in google spreadsheets. array.join(”); doesn’t seem to do the trick. I would appreciate any help. Also, anchor[i][j].join(”) returns an error.
Here is a bit of code:
anchor[i][j].join('') returns an error
anchor[i].join('') doesn’t seem to have an effect.
for (var i=0; i(less than) rangeKW.length-2;i++){
anchor[i] = [];
for (var j=0; j<rangeURL.length;j++){
anchor[i][j] = ahref + rangeKW[i] + ahref1 + rangeURL[j] + "</a>|";
}
}
cell.setValue("{" + anchor);
}
array.join()works with “normal” arrays, by normal I mean 1 dimension and applies to the array itself, not on an single element (error on [i][j]), beside that I don’t really understand what you want to do and how your code is related to your question …concerning
anchor[i].join('');// doesn't seem to have an effect.I don’t know how many elements are in there and how they look like but the syntax is correct. You can also use toString() if you want to make it a CSV string.EDIT : (thanks for the information in comments.)
I think the easiest way (or at least the most clear) would be to create a couple of new variables that you could log separately to see exactly what happens.
for example
if every index i of anchor have to be in the same cell then write it like this in the i-loop :