Next, save this act in CSV format – comma separator. In fact, any CSV will do, the main thing is to look at what separator there is. Photoshop accepts only the comma separator and, according to my observations, only the txt format, but more on that later.
It is worth paying special attention to the empty lines after the table. They shouldn’t be. You can check their presence and delete them by opening the saved file through notepad (there will be something like ‘;;;;;;;;’)
Since setting everything up the first time is also unlikely to work correctly, plus Excel is not the best way to generate random data and process them, we will use a python script to process the resulting file. In a particular case, I simulated the problem that some names are written in incomplete form (not Dmitry but Dima), and some in full. Let’s read a file, we will break each line on a separator “;”. Here, to be honest, this is probably my private problem, because when saving in CSV format – a comma separator through Excel, the separator, as it was, remains a semicolon. Therefore, I split the rows of the table by it and then process the names. You should open the CSV with notepad and see what delimiter you have. Due to the fact that the strings are similar to each other, you can safely refer to a specific word through the indices. I created a dictionary of names and if the name is not full, then I replace it with the full version. Then I write the resulting lines already separated by commas back to the file. Here you can not open the old file, as I did, but immediately save it to a new textbook, it will be even easier. At the stage of data modification, you can transform them in any way you like. Important: do not touch the first line, it should remain as it is, except that the separators will change and the number of words separated by the separator in the line will be preserved. It is worth a couple of times to output the data to the console to see if everything is in order.
The final CSV file should be like this (here is an example of empty lines, these should be deleted in advance, my script provides for this and does not break)
Export data to Photoshop
After the file is overwritten, convert it to txt if you haven’t done it before. You can do this by opening the Excel CSV file in notepad and clicking the “save as” button.
Next, open our favorite Photoshop. We need to sketch a rough sketch of the future image. It is important to make the layers that you will change (text and bitmap) separate from their own, which will not change. Suppose in my example name is a separate text layer Dmitry, sname is a separate text layer Vasichkin, img is a separate raster field Layer2, they will change.
Now we need to define variables – that is, the layers that will change
In the layer field, you need to select for each changing layer the type of its replacement (text replacement for text or pixel replacement for raster) and define the name of the variable. These are just the names of the columns that were in the original Excel file. Define the corresponding layer for each variable
An asterisk will appear next to already defined layers in the layer list. When all variables are defined, click the next button. The dataset selection menu opens. We import our text file with data, the encoding can be set automatically. The number of variables must be less than or equal to the number of data per line. If the import was successful, your data from the file will appear below
Click OK, data added
We launch a content production workshop
Everything is ready to begin to conjure. Under the variables button that we already clicked, there is a button to apply datasets. We press, put a tick on the preview and enjoy the automatic substitution of data.
Actually, it remains to slightly correct the arrangement of the layers, or something else, but these are already trifles. Spending time once to set up this way of creating content, you will save a ton of time and nerves. Happy copypasta!