Adding Bulk Users from a CSV file using Webscript

Showing results for 
Search instead for 
Did you mean: 
Established Member

Adding Bulk Users from a CSV file using Webscript

Hi All,

I have a .csv file of Users with me which i want to add using webscript. Could anyone please guide me with this how i can use webscript to read .csv file and create user from it.





3 Replies
Alfresco Employee

Re: Adding Bulk Users from a CSV file using Webscript

Hi @piyush48 ,

Have you looked at the documentation for bulk importing users on Enterprise & bulk importing into Community?


Digital Community Manager, Alfresco Software.
Problem solved? Click Accept as Solution!

Re: Adding Bulk Users from a CSV file using Webscript

There is a way to upload users in bulk using CSV via share admin tools 

[EDIT:] Look at this documentation share by @EddieMay :

You can also use this webscript to upload the users in bulk:

POST /alfresco/service/api/people/upload
Example: (POST)
Download Bulk load CSV Template from here: GET /alfresco/service/api/people/upload?format=csv

Example: (GET)

This is the webscript definition for your reference:

   <shortname>Create Users by using uploading of a CSV</shortname>
      Allows an administrator to upload a CSV describing new users,
      who will then have accounts created for them.

      Note - if the CSV is uploaded OK, but there was a problem with
      the contents or creating the users, you will receive a 200 status
      code along with details of the problem.
   <format default="json"></format>
   <!-- Transactions are handled inside the webscript itself -->

If you have something very specific requirement for bulk loading users via CSV, which can't be met using the above given approaches, then you can choose to create your own webcript.

Look at these solutions for further reference to a custom bulk load users webscript:

(ACSCE, AWS SAA, Azure Admin)

Re: Adding Bulk Users from a CSV file using Webscript

Read CSV and create user:


function isCSVDoc(document){
	var isCSV = document.getMimetype();
	return ((isCSV=="text/csv") ? "true" : "false");
function getCSVLines(){
	var csvFile = companyhome.childByNamePath("xxx.csv");
		csvDoc = document;
		var csvContent = csvDoc.getContent();
		var lines = csvContent.split("\n");
		logger.debug("=============THIS IS CONTENT========="+lines[1]);
		return lines;
	} else {	
		return null;

function main() {
	var csvLines = getCSVLines();
	if(csvLines != null)
		var nodeRefArray = new Array();
		for(var i=1; i<csvLines.length; i++)
			var column = csvLines[i].split(",");			
			var userName=column[1];
			var email=column[2];
			var firstName=column[3];
			var lastName=column[4];
			var password=column[5].trim();
			logger.debug(groupName +":"+userName +":"+email+":"+firstName+":"+lastName+":"+password);
			var newUser = people.createPerson(userName, firstName, lastName, email, password, true);