I tried using this: https://docs.moodle.org/31/en/Import_groups .I'm able to upload groups to 1 course but if I give a different course name in the coursename field, I'm getting an error saying :
Error code: ddlfieldnotexist , Field "0" does not exist in table "course".
My csv looks something like this:
groupname,description,groupidnumber,enrolmentkey,coursename
testgroup1,testing group 1,6,Abc_123,testcourse
testgroup3,testing group 2,7,Abc_124,testcourse2