Thank you. I finally use the following:
1. From csv extract comma separated logins using something like
for i in `cat ~/Downloads/export.csv | cut -f6 -d,`; do echo $i; done | sort | paste -sd "," | sed 's/"//g'
2. On the webpage where I can add the users by checking checkboxes ( http://SERVER/webwork2/COURSE/instructor/sets2/SET_NAME/users/ ) I run the following code and enter the comma separated logins from the previous step.
str=prompt("Enter logins, comma separated");
logins=str.split(",");
$.each(logins,function(index,login){$('input[value='+login+']').each(function() { $(this).prop( "checked", true ); }) })
3. Save the changes
Hope this helps to someone else in future.