Error while uploading users

Error while uploading users

by Arjen Roodselaar -
Number of replies: 6
Hi,

I'm deploying a new Moodle 1.6.2 needed for a one time event. As a finishing touch they asked me to insert 12000 user accounts and supplied me with an Excel sheet containing these users mixed. After some editing I converted this sheet to csv and tried to upload the file in Moodle.
So far I'm stuck with the following error: "" is not a valid field name
I've tried different cvs 'export' options (using OpenOffice), tried adding fields, but so far no luck.

The following lines are the first few records including the header:

username,password,firstname,lastname,email,course1,course2,type1,type2
183658,welkom,F.P.,Donders,info@bla.nl,Timmerman,Metselaar,1,1
224446,welkom,G.E.J.H.J.,Cratsborn,info@bla.nl,Timmerman,Metselaar,1,1
173203,welkom,C.P.N.,Oudhuis,info@bla.nl,Timmerman,Metselaar,1,1
76056,welkom,R.D.,Boshuis,info@bla.nl,Timmerman,Metselaar,1,1
208334,welkom,J.E.,Eekelschot,info@bla.nl,Timmerman,Metselaar,1,1

Is there anybody who has an idea why my import is failing? Am I missing an undocumented required field?

Thanks in advance!

Arjen Roodselaar
Average of ratings: -
In reply to Arjen Roodselaar

Re: Error while uploading users

by Iñaki Arenaza -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Maybe there is some 'non-visible' garbage at the start of the file. I had a similar issue with notepad when saving the contents of the file in UTF-8 encoding. It would add a few bytes at the start of the file that Moodle didn't like at all.

After opening the file in gvim (for Win32) and removing those extra bytes, the filed loaded without a problem.

Just a shot in the dark...

Saludos. Iñaki.
In reply to Iñaki Arenaza

Re: Error while uploading users

by Paul Nijbakker -
Non-visible garbage is difficult to find and delete with the tools we have. We run Moodle 1.6.3 which does not allow us to upload users with ä or ö in their names (which is rather a problem when you have Finnish users). The error message given is "unknown error encountered". Just like you I tried turning the file into UTF_8 with Notepad with as result the error message "username" is not a valid field name. How can I create .txt files containing ä and ö that will upload to Moodle if I do not have gvim?

Rgrds,
Paul.
In reply to Paul Nijbakker

Re: Error while uploading users

by Paul Nijbakker -
I downloaded gvim but when I opened the offending file I do not see anything except the same text. When I resave the file with gvim and try to upload it I get the following error message "?ername, password, lastname, firstname, email, lang" is not a valid field name.

Rgrds,
Paul.
In reply to Paul Nijbakker

Re: Error while uploading users

by Paul Nijbakker -
Anyway, for the moment the only thing that works is to replace ä with ä and ö with ö in the .txt file.

Rgrds,
Paul.
In reply to Paul Nijbakker

Re: Error while uploading users

by Iñaki Arenaza -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Notepad is a PITA with respect to UTF-8. The way it detects a given file is encoded in UTF-8 is by adding some magical bytes at the begining of the file (I seem to remember it was 3 bytes). This makes Moodle choke on the first field name.

So don't user Notepad for this smile

If you want to use gvim, you need to tell it to use UTF-8 as the file encoding. Then type/edit your text and save it. The magic incantation for the file encoding is:

:set encoding=utf-8

where and means: press and release the Escape and Enter keys respectively.

Saludos. Iñaki.
In reply to Paul Nijbakker

Re: Error while uploading users

by Katja Krüger -
I use Open Office and up to now found all errors. The teachers give me excel-tables with the user data, I open them with open office ( have to find out the character encoding they use), set it to utf-8, I change all characters wich are not o.k and then I save it as .csv. It is not allowed to have non unicode characters in the username but with all other fields ö, ä etc is o.k.
In the administration I set 'extendedusernamechars' to ' No' to avoid problems.
Katja