Duplicate and randomize your own custom Sketch data

A reader-made appendix to The Sketch Handbook by Christian Krammer

Let’s make random duplication work in 2019.

I hit a roadblock today as I was reading through The Sketch Handbook by Christian Krammer- the Craft plugin wasn’t randomizing my text or photo data when I used the duplicate feature. It also seems like many others have been experiencing this issue as well with the new version of Sketch, so here’s a quick and easy alternative for those reading the book in 2019.

Some complaints in the past month related to duplication issues.

Procuring your own custom data

In Christian Krammer’s original example from The Sketch Handbook he is populating fields using Craft’s text plugin with cities and countries for his Visit Austria app- but I’m Korean, and I want to make a Visit Korea app with dummy text that matches my context better.

I started by googling up a Wikipedia page quickly of all Korean cities. These were nicely packaged in an online tabled list.

Original table from wikipedia.

Two things that we can do from here. Either A) download a plugin that allows us to copy just the column or B) copy the entire table and paste it into Microsoft Word. Since I’m kind of lazy, I did option B.

Table pasted into Microsoft Word.

We want to save just the first column of information to use for our dummy data in Sketch. To do so, let’s do the following:

  1. Get rid of all the hyperlinks first by using CTRL + A (select all) followed by FN+COMMAND+SHIFT+F9 (remove hyperlinks).
  2. Select the column and copy it.
  3. Paste the column into any text editor and delete any extra lines. I personally like to use Brackets!
  4. Save the list as a text file and we’re ready to move to Sketch!
Column pasted into Brackets. Saving as a text file directly from Word gave me some problems, but Brackets/texteditors did the trick for me in making it work. Make sure to delete any spare lines. In this example, there is an extra line on 86, which I then removed.

Open up Sketch and use the shortcut CMD + , (open preferences). Go to the Data tab and click “Add Data.” You’ll be prompted to select a text file. Pick the one that we just created and make sure it is checked on selection!

Your custom text file will now appear!

Duplicate and randomize your data

We’re going to start with Christian Krammer’s example. Here we have a symbol with an rectangle with an image fill and some text fields that we will want to populate.

We want to duplicate and randomize a full list from this one symbol.

We’ll start by using Craft’s duplicate tool, which still works- but doesn’t randomize the outputs. You can alternatively just copy/paste or alt drag if you don’t have the Craft plugin.

I’ve set the count to 8 and the gutter to 8 pixels.
Duplicated cards, but no randomized custom content.

Once you have the generic cards spread out, let’s add randomized data using our custom text file we installed earlier. If you’ve set up your symbol correctly, all you have to do is click the little overlay icon and select your data set to populate.

I’ve prepared several custom data lists to populate my cards.
Use Unsplash and search for a photo that is relevant to your project!

And with that you now have custom randomized images and text without having to click through every single card!

This also works if you need custom text for foreign languages, which may prove useful to some designers.

From Wikipedia to Sketch!