Hi,

you can generate variations for products with the code, yes. How to implement it exactly depends on your case, how the variation data are stored, and so on.

Best,
Florian