title: Writing to an Existing Excel File
body: <pre><code> package jexcel.jxl.nimit;
  
      import java.awt.Label;  
      import java.io.File;  
      import java.io.IOException;
  
      import jxl.Cell;   
      import jxl.CellType;  
      import jxl.LabelCell;  
      import jxl.NumberCell;  
      import jxl.Sheet;  
      import jxl.Workbook;  
      import jxl.read.biff.BiffException;  
      import jxl.write.WritableCell;  
      import jxl.write.WritableSheet;  
      import jxl.write.WritableWorkbook;  
      import jxl.write.WriteException;  
      import jxl.write.biff.RowsExceededException;  
  
      public class ExcelJxl {
  
      /**
       * @param args
       * @throws IOException 
       * @throws BiffException 
       * @throws WriteException 
       * @throws RowsExceededException 
       */
      public static void main(String[] args) throws BiffException, IOException, RowsExceededException, WriteException {
          // TODO Auto-generated method stub
               ExcelJxl.WriteFile("D:\nimit.xls");
      }
  
      public static void WriteFile(String path) throws BiffException, IOException, RowsExceededException, WriteException{
  
      Workbook wb=Workbook.getWorkbook(new File(path));
  
      WritableWorkbook copy=Workbook.createWorkbook(new File("D:\temp.xls"),wb);
      WritableSheet sheet = copy.getSheet(1); 
      WritableCell cell = sheet.getWritableCell(0,0); 
      String S="nimit";
      if (cell.getType() == CellType.LABEL) 
      { 
        LabelCell l = (LabelCell) cell; 
        l.setString(S); 
      }
      copy.write(); 
      copy.close();
      wb.close();
  
      }
     }
  </code></pre>
  
  <p>I have edited my program, and now it says that setString() <strong>The method setString(String) is undefined for the type LabelCell</strong> I read the Documentation, there is a method setString in the LabelCell type.</p>