Nov 17, 2022 07:42 PM
I have a long text field with rich text formatting. I have filled in hundreds of entries in this field that will be pulled from Airtable to populate a webpage. I was asked if I could go back and make the text bold going forward. Therefore, I have two questions:
I have tried the following: creating an automation and filling the field with the current contents surrounded by two asterisks, exporting the data as a CSV file and formatting the text as bold and reimporting.
The only thing I can think of now would be a script, which I am not equipped to do.
Thank you in advance for any advice!
Gavin
Nov 18, 2022 03:44 AM
Hello @Gavin_Do !
If the content is going to be used to populate a website… - wouldn’t <strong>
tag (or CSS) on the website be a better solution?
For the sake of exercise though… :upside_down_face:
// change these names to pick a view:
let table = base.getTable('Templates');
let view = table.getView('Grid view');
let result = await view.selectRecordsAsync({fields: ['Long text']});
for (let record of result.records) {
const newText = record.getCellValue("Long text").split("\n")
.map(text=> text ?`**${text.replaceAll("**","")}**`:text).join("\n")
console.log(newText)
await table.updateRecordAsync(record, {
'Email body': newText,
});
}
Notes:
text.toUpperCase()
for extra bold website look :stuck_out_tongue_winking_eye:
I hope that helps!