Forum Discussion

Cekay's avatar
4 years ago

Use different format cells while create Excel file

Hello I have a simple script to create a test data and put that into an Excel file and that is working so far but the import of these files doesn't work because the format is not correct. 1. Some o...
  • TNeuschwanger's avatar
    4 years ago

    Hello Cekay


    The data type of the Label object is String.  You are attempting to force an integer to a string and the date type police have said that is a violation.  🙂


    I have taken the liberty to rewrite the offending code into something a little more groovyish...


    //for(int i=0;i<merchant.size();i++){
    //Label label = new Label(i, 1, merchant[i]); // i = column=0=A, row=1
    // merchant[i]
    merchant.eachWithIndex { val, indx -> val.getClass();
       if (val instanceof Integer) {
          Number number = new Number(indx, 1, val);
       if (val instanceof String) {
          Label label = new Label(indx, 1, val);



    What you use in the .addCell() method is data type dependent.  If you need other data types other than a string or number, you will have to google for other examples (I just looked for solution only to your issue).