You have to start with making sure that you can pull a "report" with that info.
So when you do a "gam print users ...." you will have the info you need and can push that to a csv or Google Sheet on a single line.
If you can't, then it'll be hard to use that as source when pushing changes to those users.