Apple Event: May 7th at 7 am PT

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Is it possible to use a formula or script to extract a "formatted" hyperlink from text in a cell into a new cell in the same row?

I have several lists of contacts where the company name is hyperlinked to the company website. That is, the company name is formatted as a hyperlink and the appropriate address is "in the formatting".


I want to extract those hyperlinks as a data element in the same row.


Can be done manually... but would like to find a way to avoid manually doing this for several thousand rows of data.

Posted on Mar 6, 2015 11:04 AM

Reply
7 replies

Mar 6, 2015 11:41 AM in response to SGIII

Hi... thanks for your question. I'm not sure exactly how to articulate it.


The cell content is text... select text and add hyperlink. I want to extract the hyperlinks that have been added to the text in this manner.


What I've got is long series of rows where columns are business name, city, address. Business names are hyperlinked... I want to put that link into it's own column where the actual link info is the data.


So I'm not sure then if the text is actually a "data element" associated with the cell or if it is an attribute like bold/italic or...?


darren

Mar 6, 2015 12:22 PM in response to SGIII

User uploaded file


Ok... here's a cropped screehnshot


The rows in the top half of the page show the data where I have manually pulled the url into the third column.


First column - company name

second column - location

third column - I have been manually pulling the url and pasting it into this column


One the active line with the data "Boreal Camp Services & Outfitting" I have selected the text and hit Command-K to show the hyperlink associated with the data.... and that's the dialogue that opens. I have simply been copying the url from this point and pasting it into the third column.


So... the question is... can I somehow create a script/formula/automator that will do this across the entire sheet?


I tried to record using automator... didn't work... but I don't really know what I'm doing there.


d

Mar 6, 2015 1:01 PM in response to dnim

AppleScript doesn't seem to have access to the actual link. A "gui script" might be possible (where AppleScript emulates clicking the cell and selecting the text). But I'm not sure how to do that.


If you have Excel you can export as xlsx and run the VBA macro here. The copy-paste the results back to Numbers.


SG

Mar 6, 2015 1:04 PM in response to SGIII

Thanks for your thoughts... but I may have just come up with another work around.


By pasting the data into a Word doc and showing fields, it shows the link data instead of the name with the link "formatted" to it. So I'll have to massage it a bit to clean up, but that's just a matter of running a series of find/replaces.... then I can paste it back in.


But thank you... you seem to have confirmed what I thought... that the link is not being treated as data but rather as some kind of attribute or ??


cheers and thanks for your time


darren

Mar 6, 2015 1:30 PM in response to dnim

Yes, the hyperlink text appears to be a property or attribute that AppleScript can't access, but VBA can.


I tried your idea of showing fields in Word. That works here. A little manual cleanup should do it.


Excel, if you have it, would give the list without cleanup, but you'd first have to save the xlsx as xlsx and copy-paste the code into a "module" in Visual Basic Edit. That's quick... but can seem intimidating the first time... until you realize how easy it is.


SG

Is it possible to use a formula or script to extract a "formatted" hyperlink from text in a cell into a new cell in the same row?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.