A Script To Clear Data Sets In Adobe Illustrator


I use the data merge feature in Illustrator to mass generate certificates at work. You can upload your data as CSV or XML file though I’d recommend doing it through the Variable Importer script.

As great as it is, one annoying thing is that it’s hard to clear our the datasets as it makes you do it one by one. To do this, I had to create a script which just loops through the data sets and deletes them.

#target illustrator;
var doc = app.activeDocument;
for (var i=doc.dataSets.length-1; i >= 0 ; i--) {
	var d = doc.dataSets[i];

I had to loop down since mutating an array while looping over it would only clear half of the elements.