Powershell Script to export group membership to multiple CSV

Currently I have a script that exports single group membership to CSV. My requirement is script should take multiple group names from input csv and export membership to multiple output csv based on group name. For an example input file contains 3 groups i.e Group1, Group2, And Group3. Script should generate 3 csv files, 1 with each groups membership.

Hi, welcome to the forum :wave:

Please share your code. What have you tried so far to implement a solution for querying multiple groups?