Importing heirarchy of tags

is there a way to import a tag heirarchy via a sheet?? like have fifty rows, three columns, where a script would create a tag for column c which could be nested in a newly created tag from column b which would be nested in a newly created tag from column a?

Yes, tags can be created using Applescript
You will be creating a record with type tag
edit: actually type “group”, created in the tag group
The dictionary specification is listed in the screenshot below
Note - it specifies “in record” which defines the hierarchy

The tagnames can be retrieved from a sheet
Just curious as to why you have a sheet of tagnames?

Seeing the document you’re referring to would be helpful.
And I’m as curious as @DTLow… why do you have a sheet of tagnames?

they’re geographies

Here’s a sample script

tell application id "DNtp"
	
	set theTagGroup to get record with uuid "E9390B1F-0B97-4145-BDE1-956A16F3510C"
	set theTagtext to plain text of content record -------------The Tags sheet
	
	set oldDelims to AppleScript's text item delimiters ------------ Parse the sheet by rows
	set AppleScript's text item delimiters to {linefeed}
	set theTagRows to every text item of (theTagtext)
	set AppleScript's text item delimiters to oldDelims
	
	repeat with theTagRow in theTagRows
		
		set oldDelims to AppleScript's text item delimiters --------- Parse the row by Tags
		set AppleScript's text item delimiters to {"	"}
		set theTags to every text item of (theTagRow)
		set AppleScript's text item delimiters to oldDelims
		
		if theTags is not {} then
			set TagA to item 1 of theTags
			set TagB to item 2 of theTags
			set TagC to item 3 of theTags
			
			set theTagA to create record with {name:TagA, type:group} in theTagGroup
			set theTagB to create record with {name:TagB, type:group} in theTagA
			set theTagC to create record with {name:TagC, type:group} in theTagB
		end if
		
	end repeat
	
end tell
1 Like

Like US > Ohio > Cleveland ?

See what the sheet looked like would be helpful.

maybe a sheet isn’t the best way to do it, which leads me to my next question - if i wanted to duplicate the tag heirarchies and aliases from one database to another, what would be the best way to do that? imagine thousands of tags - around 20k - with about 50 main tags and everything else nested w/in those 50.

I already scripted importing the tag hierarchy from a source
I could script exporting the tag hierarchy; probably to a tab delimited file

My use case was importing tags hierarchy from the Evernote platform

20,000 tags?? :flushed:

1 Like