Cannot upload cohorts from csv

Cannot upload cohorts from csv

by Chintan Gandhi -
Number of replies: 10

I cannot upload cohort information for existing users using CSV. I have looked at both the links:

https://docs.moodle.org/34/en/Cohorts#Uploading_users_to_a_cohort and

https://docs.moodle.org/34/en/Upload_users#Cohort_membership_assignment.


I have already tried with column name as "cohort1". Every time, I upload a CSV, I meet with the following error:

"There is something wrong with the format of the CSV file. Please check that it includes column names."

Moodle version=3.3

Thanks in advance.

Average of ratings: -
In reply to Chintan Gandhi

Re: Cannot upload cohorts from csv

by AL Rachels -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

Hi Chintan,

"cohort1" will work fine as a column name for cohorts, but what about the other column names you are using? What are they? Seems like it might be one of them causing the error.

Average of ratings: Useful (1)
In reply to AL Rachels

Re: Cannot upload cohorts from csv

by Chintan Gandhi -

As mentioned in the link: https://docs.moodle.org/34/en/Upload_users#Cohort_membership_assignment, I have included only 2 columns namely "username" and "cohort1". For testing purposes, I have updated cohort information for only 1 user. 

I am attaching a screenshot of the CSV file for your reference.

If possible, can you please share a sample CSV for the given case?

Thank you for the quick reply.

Attachment cohort_file_ss_1.png
In reply to Chintan Gandhi

Re: Cannot upload cohorts from csv

by AL Rachels -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

Hi Chintan,

The two column headings you show are correct, but only if the cohort, KMP_CP1, has already been created. If KMP_CP1 is not already exiting, then the firstname, lastname and email address of the user are required also.

I have never used the two column method. I have attached a csv file with just the headings that I use, with all the user info deleted.


Average of ratings: Useful (2)
In reply to AL Rachels

Re: Cannot upload cohorts from csv

by Chintan Gandhi -
The problem is solved now. Like you suggested, when I added the "firstname", "lastname", "email" columns for users along with "username" and "cohort1" columns, the CSV file works and users are enrolled into different cohorts.

Thanks a lot for your help, AL Rachels.
Average of ratings: Useful (1)
In reply to AL Rachels

Re: Cannot upload cohorts from csv

by marisol castro -

Hello Al!

I am hoping you can help me with this same issue?  I followed the instructions of having username, firstname, lastname, email, and cohort1 in my CSV file and I still continue to get the error.  Any other suggestions?  I even deleted the cohort1 column and tried it but got the same result. 

In reply to marisol castro

Re: Cannot upload cohorts from csv

by AL Rachels -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

Did you try using the file I supplied up above and add your users to it? Unused columns can be deleted. One common problem I've seen is that username can only contain alphabetical lowercase letters , numbers, hypen '-', underscore '_', period '.', or at-sign '@' os you might want to check for problems there.

Average of ratings: Useful (1)
In reply to AL Rachels

Re: Cannot upload cohorts from csv

by Narit B -

Hi AL Rachels,

I used Moodle 3.3 with NAS 453 Pro

I already used your file as above and upload it also got the same issues.

"There is something wrong with the format of the CSV file. Please check that it includes column names."


Note: I upload via Upload Cohort. is that correct way?


Could you please advice?


Thank you

In reply to Narit B

Re: Cannot upload cohorts from csv

by C Behan -

Narit,


To add users to a cohort go to [yourmoodlesite]/admin/tool/uploaduser/index.php

That warning you are seeing suggests to me that you are instead uploading the CSV file to the area that you use to create cohorts, not to add users to cohorts.

Catherine


Average of ratings: Useful (1)
In reply to C Behan

Re: Cannot upload cohorts from csv

by Narit B -

Hi Catherine,

Thank you for responded and corrected me with the right way.