// Create a new workbook Workbook workbook = new Workbook(); Workbook.AddCustomFunction(new GeneralID()); IWorksheet worksheet = workbook.getActiveSheet(); worksheet.getRange("A1").setFormula("=GeneralID()"); Object valueA1Before = worksheet.getRange("A1").getValue(); worksheet.getRange("A2").setFormula("=GeneralID()"); // A1's value has changed. Object valueA1After = worksheet.getRange("A1").getValue(); /* Implementation of GeneralID class GeneralID extends CustomFunction { public GeneralID() { super("GeneralID", FunctionValueType.Object); this.setIsVolatile(true); } @Override public Object evaluate(Object[] objects, ICalcContext iCalcContext) { return UUID.randomUUID().toString().replaceAll("-",""); } } */