Hi Lads,
I'm trying to read from one spreadsheet, extract the contents of certain cells, and write them into a new spreadsheet. I've read from one spreadsheet fine, but when I try to write to a new spreadsheet, the output file is empty and I can't see why. Can anyone see what I'm doing wrong?
//All headers and class definition etc in order
.
.
.
Workbook workbook1 = Workbook.getWorkbook(new File("C:/Documents and Settings/spreadsheet.xls"));
Workbook workbook2 = Workbook.getWorkbook(new File("Spreadsheet1.xls"));
WritableWorkbook workbook = Workbook.createWorkbook(new File("output.xls"));
WritableSheet sheet = workbook.createSheet("First Sheet", 0);
Sheet sheet1 = workbook1.getSheet(0);
Sheet sheet2 = workbook2.getSheet(0);
int iRows = sheet1.getRows();
int jRows = sheet2.getRows();
int n = 0;
for (int j=0; j<iRows;j++){
Cell col_E = sheet2.getCell(4,j);
Cell col_I = sheet2.getCell(8,j);
Cell col_L = sheet2.getCell(11,j);
String computer = col_E.getContents();
String hostname = col_I.getContents();
String ipAddress = col_L.getContents();
System.out.println(techOwner);
Label label1 = new Label(5, n, techOwner);
Label label2 = new Label(5, n, hostname);
Label label3 = new Label(5, n, ipAddress);
sheet.addCell(label1);
sheet.addCell(label2);
sheet.addCell(label3);
n=n+1;
}