Creating sheet with applescript - column types

After much error I have managed to get an applescript to create a new sheet just where I want it, with named columns. However, those columns default to type: multiline text. Does anyone know if there is a way to specify a different column type for a new column within the new sheet e.g. date?

If anyone is interested, I got around my specific issue by creating a template with the right column types and just importing that template each time I wanted a new sheet with those column types. As ever with DT Applescripting, I’m sure there is a more elegant solution but I bumbled my way through!

Curious to see your script. I probably can’t help, but I’m trying to learn.

You can bet that importing a template is going to be much faster than generating a sheet in a script. See this discussion for a similar case: DT3 JSON Parser

@jongilizwe is correct here. This is the exact purpose of a template and the method we would advocate people use in this situation.

Thanks all for your responses. Feels a bit ugly relying on a fixed template on the local file system and having no programmatic flexibility (and a bit odd that the option exists to create a sheet with AppleScript but not to specify basic options). However, the template approach works fine in my usage case so all good. Case closed!

Hi

Do u mind posting ur original script for creating a sheet with named columns? I hope to learn how to do it.

Thanks

Hi,

If you are happy with multiline text columns then you can programmatically create a new sheet with named columns thus:

tell application id "DNtp"
	create record with {name:"mysheet", type:"sheet", columns:{"one", "two", "three"}}
end tell

Obviously you can specify where you want the sheet to go in the script.

However, unless you have a dynamic set of columns, I suggest using templates instead of this script.

Thanks! And yes, mine will be created in a dynamic manner.

Get this from @cgrunenberg, too: How to create a sheet from a list of list by Applescript?