Does anyone know of a way to underline a portion of text in a Google Sheets cell? I am really looking for a function like my Title to this query.
I have played with .getDisplayValue, .getValue for the Range class and have tried to see if the Doc Text Class might be reachable from Google sheets with no success. I do know I can do this directly from Google Sheets but need to this capability from Google Apps Scripts (GAS).
I also know that this capability in the actual spreadsheet editor is new and may be that the Apps Script needs to catch up.
Thank you for any responses there may be.
Terry
Try the function below for applying underline to your string. Unfortunately, Google Sheets don't seem to support continuous underline.
function underline(string, start, end) {
start = start || 0;
end = end || string.length;
var res = "";
for (var i=start; i < end; i++) {
res += string.charAt(i) + "\u0332";
}
return res.toString();
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With