How to configure an attribute based on how the user is created?

Hello,
I have to configure a template where the ImportSource attribute has a value if the creation of a user comes from CSV, otherwise it has another value assuming the creation of the user comes from the user portal.
How can I distinguish these two cases?
Thankyou,
Elena