Pro only
DatasetsDatasets is a feature in Fake Data extension that allows you to use your own data instead of using the default ones from the Faker library. For example, you can upload a CSV file with names that you want to use instead of relying on the ones that are generated by Fake Data.
Add a new Dataset
To add a new Dataset, follow the next steps:
- Open Fake Data's options page.
- Go to Settings -> Developer Options -> Datasets.
- Click on "Add a new Dataset".
- In the newly opened modal, type a name that you want for your dataset, then select a CSV file.
- Press Save.
If the dataset was added successfully, you should see a table with the data that was imported in Fake Data.
You can also add a new Dataset from Google Sheets.
Use a Dataset in a Generator
After uploading a new Dataset, there are multiple ways to use it. One of them is by assigning it to a Generator. Both Default Generators and Custom Generators support the Dataset feature. In order to tell a Generator to use values from a Dataset column, follow the next steps:
- Open Fake Data's options page.
- Go to Generators -> go to either Default Generators or Custom Generators.
- On the right side of each Generator, click on the dropdown menu and choose
Dataset
. - A second dropdown should appear immediately that will ask you to choose a column from any of your uploaded Datasets.
- Once a column is selected, press Save.
Now each time you invoke the updated Generator, it will return a random value from the selected column in the selected Dataset.
Below is a quick demo on how to create a new Custom Generator that will use a Dataset:
TIP
In Custom Generators, if you want to get a Dataset value programmatically, you can use the fakeData.getDatasetValue('<dataset name>', '<dataset column>')
method. Go to method documentation.
Assign a Dataset column to one field only
If you don't want to create a new Generator or override the existing ones, you can also quickly assign one of the Dataset columns to a form input through the Manage Field modal:
- While filling out an online form, right-click on the input field you want to modify.
- Go to "Fake Data" submenu and choose "Manage Field".
- On the newly opened modal, under "Generator" section, choose
Dataset
. - A new option should show up immediately right below the "Generator" section, called "Dataset".
- In this new dropdown, choose one of the columns from your Datasets that you want to use.
- Press Save.
Now, when you fill the form again, your changed input field will be filled with a random value from the selected dataset column.
Here is a quick demo video: