Help

Bolding text in multiple records at once

1065 1
cancel
Showing results for 
Search instead for 
Did you mean: 
Gavin_Do
4 - Data Explorer
4 - Data Explorer

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:

  1. Can I somehow go back and format all the text as bold in AT similar to how it could be done in Excel/Sheets?

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.

  1. Going forward, will there be functionality where I can edit the field type where by default, all entries will be bolded?

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

1 Reply 1

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:

  • updating Airtable should be batched , above is inefficient with a bigger number of entries → there are some batching examples around
  • I am arbitrary removing ** to avoid “double boldening”, a nicer regex would be better instead
  • the asterisks need to be added for each line, so I am breaking text by line (“\n”)
  • you can also add text.toUpperCase() for extra bold website look :stuck_out_tongue_winking_eye:

I hope that helps!