Data Source Copies example to replace text from a CSV file
In this example, we will replace two text items with a name and number, where the data will be pulled from a specified CSV file.
In the
Style tab, choose
"Edit Data Source..."
We will get data from a CSV file as shown below. It has 3 columns, where the first column has the first name, second column as last name and third column has the player's number.
To create the Data Source for the player name:
- Enter a Name for the Data Source. Here we are using "last name".
- Choose "CSV" as the Data Source Type.
- Click Choose... to select the CSV file to use.
- In our CSV file, the last names are in the 2nd column, so set 2 as the Start Column.
- We will choose to Auto Increment by Row, so it will get the next name in the column each time it replaces the data.
- In our example, we will want the name to be all uppercase, so will check the Convert Case option and set to UPPERCASE as the data in the CSV file is not all uppercase.
- Click the Add button to add the Data Source to the list.
Now we will create another Data Source for the Number.
- We will set the Name to "number".
- Set the Data Source Type to "CSV".
- As we are using the same CSV file as before, we can choose it from the File drop down list.
- The numbers are in column 3 in the CSV file, so set the Start Column to 3.
- Again set Auto Increment by Row to incrementally get next number from the column in the CSV file.
- Click Add to add the Data Source to the list.
Now we will assign the appropriate
Data Source to each text object. First select the "PLAYER "text, and in the
Style tab, you can check the
Data Source check box. In the drop down list, you should see the 2 data sources we just added. Choose "last name" so that this "PLAYER "text will be replaced with data from the "last name" source.
Next, select the "99" text object, and set the
Data Source to "number" so this text will be replaced with the data from the "number" source.
We can choose
Preview... to see how it will look like with the data replaced as specified.
In this example, we are wanting to see the first 3, so here we are setting the Rows to 3 and click the
Preview button and you should see the name and numbers replaced with the text from the first 3 entries in the CSV file. If it looks OK, you can click the
Make Pages button and it will add pages to the project with the replaced data as shown in the Preview.