Since the introduction of the new spreadsheet version one can change text attributes inside a single cell (or merged cells) manually like in this example :
(left = raw text, right = formatted text, easier to read)
I don't see any way to achieve that by script... I don't see any issue nor feature request in the issue tracker either.
Is that possible ?
Every method I try to get the text attributes only returns a single value so I'm afraid I just can't do it... but who knows ?
Thankfully, you can – to type information into more than one line in a Google Sheets cell, click on the cell in question and type the first line of your content in. Then, press Alt + Enter on your keyboard (or Option + Enter if you use a Mac) to get to a new line.
In the Google Sheets spreadsheet, select the cell where you want to create the SUM formula and display the cell values total. Type =SUM( to start creating the formula. Only enter the open (left) parenthesis and not the close (right) parenthesis yet. Select the cells containing the values you want to total.
You can have multiple scripts in the same script file and you can have multiple script files as well. If you click on the small downward-facing arrow at the right of the Script file name, it will show you options to rename, delete, and create a copy of the script file.
On 2016, when this answer was originally posted, in Google Sheets was not possible to programatically apply formatting to cell content parts.
Please star the The following feature request on the Google Apps Scripts issues and feature requests official site is now fixed.
Issue 6000: Handle parts of cell content programmatically
According to the release notes of January 22, 2019 Google Apps Script was updated to include new classes and methods to handle cell content formatting like RichTextValue
.
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