@Nikita___Garg Best way would be to handle it through Groovy script. As it's a one time activity, writing the code logic would take longer time compared to Groovy script which you can simply write and test it in lower environment.
I also faced similar kind of challenge where client and AMS wasn't...