Reputation: 887
I am trying to build a complex string to insert a new formulae on the fly in google script. In VBA you use chr(34), is there a similar work around in google script?
Thanks
Upvotes: 0
Views: 2301
Reputation: 7771
From this thread "Some common VBA functions translated to Google Apps Script" you will find here in Slide 6 that the function Chr(n)
in VBA is translated in the javascript:
function Chr(n) {
return String.fromCharCode(n);
}
You can also find it in this Github.
For the sample code on how to use this function in AppsScript, check this link.
var map = Maps.newStaticMap();
for (var i = 0; i < route.legs.length; i++) {
var leg = route.legs[i];
if (i == 0) {
// Add a marker for the start location of the first leg only.
map.setMarkerStyle(markerSize, markerColor, String.fromCharCode(markerLetterCode));
map.addMarker(leg.start_location.lat, leg.start_location.lng);
markerLetterCode++;
}
map.setMarkerStyle(markerSize, markerColor, String.fromCharCode(markerLetterCode));
map.addMarker(leg.end_location.lat, leg.end_location.lng);
markerLetterCode++;
}
Upvotes: 1