Scripting the User Upload (CSV/XLS)

Scripting the User Upload (CSV/XLS)

by Kris Ring -
Number of replies: 1

Moodle version: 3.5


I am a contractor working for a company that is utilizing Moodle. What I am trying to do is create a Selenium (not with behat) framework from scratch - which the actual Selenium part I have working just fine. Where I need help is in the uploading of a CSV file to put new people onto a team so that whatever automated tests are needed to be run - they can be run by a new user each time.


The problem I am running into - and I can share my code if needed - is that when I upload the file directly to the getcsv.php endpoint - I get a 200 response but in the content of the response I get a message stating:


{"meta":{"fields":false,"usercount":0,"errors":[""],"invalidemail":0,"needseats":false,"displaydownload":false,"general":{"users":[],"errors":[],"invalidemails":0}},"action":"teaminitialcheck"}


What it looks like is that my code is fine - I don't get any error - but it's as if the contents of the file are either not being sent - or not being read. I don't at this time have the developer's code running locally I am just connecting to their test environments.


There is one user in the CSV - and the file itself just has an email address, first and last name field.

I haven't added my code here - but if anyone is interested in assisting me in this I can share it - I am working in python (and I'm not necessarily a pro at it either ;) )


Much appreciation to any help anyone can provide!

Average of ratings: -
In reply to Kris Ring

Re: Scripting the User Upload (CSV/XLS)

by Colin Fraser -
Picture of Documentation writers Picture of Testers

Surprised you haven't had a response to this yet...4 days, not good... 

Is it possible that Moodle is rejecting the file as it is not properly formatted for Moodle? I understand the minimal format needs be: 

      username,firstname,lastname,email

in that order...which looks like: 

    username,firstname,lastname,email
    johnsmith,john,smith,john.smith@home.org