Skip to main content

Combining Text Column & URL Column to create Text with Hyperlink inline

  • August 26, 2020
  • 7 replies
  • 185 views

Hi! I have the following set up:

Column A: Name
Column B: Text
Column C: URL

I would like to combine these into a new column to read like so:

“Text (with hyperlink) - Name”

I should note that the URL is to an external page, and not an internal reference to another base / table / etc. Any idea how to help with this? Thanks!

7 replies

Justin_Barrett
Forum|alt.badge.img+21
  • Inspiring
  • 4647 replies
  • August 26, 2020

Welcome to the community, @Steve_Marks1! :grinning_face_with_big_eyes: That kind of hyperlink can’t be created via formula at this time. You can manually create something like that in a long text field with rich text enabled, but formulas can’t currently create rich text. I haven’t yet tried creating such rich hyperlinks via scripts, though, but I might play around a bit. If I do, I’ll let you know how it turns out.


  • Author
  • Participating Frequently
  • 5 replies
  • August 26, 2020

Welcome to the community, @Steve_Marks1! :grinning_face_with_big_eyes: That kind of hyperlink can’t be created via formula at this time. You can manually create something like that in a long text field with rich text enabled, but formulas can’t currently create rich text. I haven’t yet tried creating such rich hyperlinks via scripts, though, but I might play around a bit. If I do, I’ll let you know how it turns out.


Hi @Justin_Barrett . Do you know if this can be achieved through Integromat?

Thanks for taking a look at my question!


Justin_Barrett
Forum|alt.badge.img+21
  • Inspiring
  • 4647 replies
  • August 26, 2020

Hi @Justin_Barrett . Do you know if this can be achieved through Integromat?

Thanks for taking a look at my question!


Possibly. I ran a really brief test a while ago (shortly after rich text was added to Airtable) creating rich text via Integromat, and it worked. You just need to follow the markdown syntax as outlined in the docs. My gut says that if it works from Integromat, it would probably also work internally using a script (either the Scripting block, or an automation).


Justin_Barrett
Forum|alt.badge.img+21
  • Inspiring
  • 4647 replies
  • August 26, 2020

Just ran a quick test with the scripting block, and it works. Here’s my test script:

let tb = base.getTable("URL Test");
let query = await tb.selectRecordsAsync();
for (let record of query.records) {
    let url = record.getCellValue("URL");
    let name = record.name;
    let text = record.getCellValue("Text");
    if(url) {
        tb.updateRecordAsync(record, {"Rich": `[${text}](${url}) - ${name}`})
    }
}

This will only make the hyperlink when there’s a URL in the {URL} field. With a little more twiddling, this could be modified to work via Airtable’s automation system, to automatically create the hyperlink as the record is being edited.


  • Author
  • Participating Frequently
  • 5 replies
  • August 29, 2020

Just ran a quick test with the scripting block, and it works. Here’s my test script:

let tb = base.getTable("URL Test");
let query = await tb.selectRecordsAsync();
for (let record of query.records) {
    let url = record.getCellValue("URL");
    let name = record.name;
    let text = record.getCellValue("Text");
    if(url) {
        tb.updateRecordAsync(record, {"Rich": `[${text}](${url}) - ${name}`})
    }
}

This will only make the hyperlink when there’s a URL in the {URL} field. With a little more twiddling, this could be modified to work via Airtable’s automation system, to automatically create the hyperlink as the record is being edited.


Thank you for this! This is great!


Forum|alt.badge.img+3
  • New Participant
  • 4 replies
  • December 2, 2022

I'm trying to do something similar, but getting some odd results — and not all of the records are being processed — with other scripting blocks I've seen, I can recall sometimes there is a need to slice the records 50 at a time?

What am I missing here?

// Combine Twitter Handles with URLs to make richtext links
let tb = base.getTable("People");
let query = await tb.selectRecordsAsync();
for (let record of query.records) {
let handle = record.getCellValue("Twitter Handle");
if(handle) {
tb.updateRecordAsync(record, {"Twitter Link": `[${handle}](https://twitter.com/${handle})`})
}
}

Forum|alt.badge.img+2
  • New Participant
  • 3 replies
  • December 5, 2022

Just ran a quick test with the scripting block, and it works. Here’s my test script:

let tb = base.getTable("URL Test");
let query = await tb.selectRecordsAsync();
for (let record of query.records) {
    let url = record.getCellValue("URL");
    let name = record.name;
    let text = record.getCellValue("Text");
    if(url) {
        tb.updateRecordAsync(record, {"Rich": `[${text}](${url}) - ${name}`})
    }
}

This will only make the hyperlink when there’s a URL in the {URL} field. With a little more twiddling, this could be modified to work via Airtable’s automation system, to automatically create the hyperlink as the record is being edited.


Can anyone tell me why it only works for some records but not all records? Thanks in advance.