Forums | Mahara Community

Support /
Can't add accounts by CSV


MarionMacDonald's profile picture
Posts: 203

03 September 2022, 3:24

Hello

Whenever I try to upload a CSV of new users, I get:

The field name "username" is invalid, or you have more fields than your header row specifies.

I have tried username in all lower case, init caps and all upper case.  I have checked that I don't have an empty column or row.  I have tried adding " quotation marks around all fields.  My file is UTF-8.   The fields I have used are:

username password email firstname lastname studentid
12345678 whatever [email protected] Marion MacDonald 12345678

 

Does anyone have any ideas?

Regards, Marion

 

MarionMacDonald's profile picture
Posts: 203

03 September 2022, 3:24

We are on version 21.10.3

Robert Lyon's profile picture
Posts: 773

05 September 2022, 9:40

Hi Marion,

 

Looking at my CSV test file that works for me I have the following:

username,password,email,firstname,lastname,studentid,occupation,town
test001,Password123!,[email protected],Test,One,testone,Programmer,Wellington

I note that my fields are separated by a comma.

I wonder if your are separated by something else, maybe a {tab} character?

Can you please try making a file where the values are separated by commas to see if that makes any difference for you.

Cheers

Robert

MarionMacDonald's profile picture
Posts: 203

05 September 2022, 20:13

Hello Robert

Thanks for your reply.  Sorry, the way I formatted my example obscured the fact that I am definitely using commas :(   When it didn't work, I tried encompassing each field in straight quotes as well but that made no difference.

Regards, Marion

MarionMacDonald's profile picture
Posts: 203

05 September 2022, 20:42

Hello Robert

It's working today :)  The only thing I've done differently was select the 'saml' institution rather than 'internal'.   When I had created individual accounts last Friday, I used 'internal' and it worked fine and their accounts switched to 'saml' when they logged in.

Regards, Marion

Kristina Hoeppner's profile picture
Posts: 4863

06 September 2022, 15:32

Hi Marion,

The authentication method shouldn't switch on its own unless you allow that people can link their internal Mahara account with SAML authentication. You can check that in the SAML settings of the institution.

When you upload a CSV that contains new accounts, you do need to fill in the password field, even if you set them up as SAML accounts. That field is required for new accounts.

Cheers

Kristina

MarionMacDonald's profile picture
Posts: 203

07 September 2022, 21:06

Hello

I discovered in the end that it had something to do with the actual CSV file.  The ones I created on Friday were prepared in Excel but the work I prepared on Monday in Word was the one that actually worked.  I had been checking that the format was UTF-8 and various other things like that.  I was able to finish the job on Monday by pasting new names into the file that worked and saving with a new name :)  

Regards, Marion

MarionMacDonald's profile picture
Posts: 203

09 November 2022, 8:25

Just for info - in case someone else comes across the same issue.

CSV files created by Windows Notepad are saved by default with a BOM (Byte Order Mark) in each line, character 1.  You can't see the character in Notepad, Excel or Word, although Word will display it when you go through the process to save as plain text.  Then you can see a square in position 1 on each line.

To fix, use just encoding UTF-8 as opposed to UTF-8 with BOM when saving in Notepad.

Regards, Marion

 

Kristina Hoeppner's profile picture
Posts: 4863

10 November 2022, 8:52

Thanks for sharing that tip, Marion.

Cheers

Kristina

9 results