Hi All,
we have an requirement, that customers sends Excel file to us(directory).
we need to pick that Excel file and process it.
problem I am facing is how to convert Excel file to csv or WmDoc via code.
I searched and came to know, we have a package EXCEL_contentHandler .
I tried it but no use.
can anyone help me out from this. it’s very urgent
more over i don’t know java. so please give me points in details. thanks
Thanks in Advance
use the API’s in [URL]A Java library for reading/writing Excel - Browse Files at SourceForge.net
HI,
i have Java service code
try {
IDataCursor pipelineCursor = pipeline.getCursor();
byte excelBytes = (byte) IDataUtil.get(pipelineCursor, “excelBytes”);
pipelineCursor.destroy();
jxl.Workbook rwb = jxl.Workbook.getWorkbook(new java.io.ByteArrayInputStream(excelBytes));
jxl.Sheet sheets = rwb.getSheets();
IData resultSheets = new IData[sheets.length];
for (int i = 0; i < sheets.length; i++) {
IData idata = IDataFactory.create();
IDataCursor cursor = idata.getCursor();
IDataUtil.put(cursor, “sheetName”, sheets[i].getName());
int rows = sheets[i].getRows();
int columns = sheets[i].getColumns();
IData sheetData = new IData[rows];
for (int j = 0; j < rows; j++) {
IData rowData = IDataFactory.create();
IDataCursor rowCursor = rowData.getCursor();
for (int k = 0; k < columns; k++) {
IDataUtil.put(rowCursor, “field” + (k + 1), sheets[i].getCell(k, j).getContents());
}
rowCursor.destroy();
sheetData[j] = rowData;
}
IDataUtil.put(cursor, “sheetData”, sheetData);
cursor.destroy();
resultSheets[i] = idata;
}
rwb.close();
pipelineCursor = pipeline.getCursor();
IDataUtil.put(pipelineCursor, "sheets", resultSheets);
pipelineCursor.destroy();
} catch (Exception ex) {
throw new ServiceException(ex);
}
and i have put Jar file at package/code/jar.
but still am getting below error
/operations/webMethods/webMethods6/IntegrationServer/packages/practice/code/source/kishore/Excel.java:43: cannot find symbol
symbol : class io
location: class kishore.java
jxl.Workbook rwb = jxl.Workbook.getWorkbook(new java.io.ByteArrayInputStream(excelBytes));