JXA: How to get URL-s from Item Link columns in Sheets

I become using Sheets — really perfect for registers and catalogs.

Especially like Item Link column.

BUT

  • user needs to see filenames with thumbnails
  • developer needs to get URL-s

The problem is

  • Item Link column gives filename only to developer
  • URL column shows URL only to user

How JXA/AS developer can get URL-s from Item Link columns?

If currently impossible, my suggestion is the following: If there is URL like
x-devonthink-item://009BC79F-928B-42E7-BACB-1EA1C6BE06D8 in URL column, to show filename with thumbnail.

I’m not sure I understand what you’re asking for. Could you perhaps show a mock-up of what you want to see where in the table?

source of sheet — .tsv file

"№#int"	"Customer#crosslink"	"Status#string{values:Packed|Shipped}"
"3"	"x-devonthink-item://3B75746A-C861-4167-8852-55EB05A7B4AD"	"Packed"
"2"	"x-devonthink-item://B3BE509A-8DFC-4C68-8A16-B99CA5D393EB"	"Shipped"
"1"	"x-devonthink-item://130F1137-F04B-46DA-B27D-5840F63DF7C8"	"Shipped"

what user see

what developer gets with app.selectedRecords[0].plainText()

№	Customer	Status
3	2022-08-12 Sale № 20.md	Packed
2	2022-08-10 Sale № 19.md	Shipped
1	2022-08-08 Sale № 18.md	Shipped

No URL-s here.

I can keep the same URL-s in two columns — Item Link and URL types. This way user would see filenames in one column, and URL-s in another column, and developer would get access to URL-s. But it is double data, bad approach.

Well, you’ll have to get the cells, not the plaintext. That’s a bit wird because the table properties are not at the record but at some kind of window. Searching for „cell“ or „row“ in the dictionary will reveal that.

1 Like

Helped!

I’ll use cells and columns like below

let cells = app.selectedRecords[0].cells();
let columns = app.selectedRecords[0].columns();

Thank you, Christian!

Пожалуйста :wink:

1 Like