有,不过没在手头放着,jdbc+odbc连的话,也不用想具体是excel还是sqlserver,拿来用就好了

解决方案 »

  1.   

    有专门操作excl的jar包,找一下,很好用的。
    java 对excl的操作不是很难
      

  2.   

    poi 和jex吧....有开源的包的............................
      

  3.   

    用poi,这是我的一个例子,如果要修改,可先用
    fs = new POIFSFileSystem(new FileInputStream("d:/workbook.xls"));
             wb = new HSSFWorkbook(fs); 
    读入,修改后再用
    FileOutputStream fileOut = 
    new FileOutputStream("d:/workbook.xls");
    wb.write(fileOut);
    回写
    import org.apache.poi.hssf.usermodel.*;
    import java.io.*;
    import java.util.*;
    import org.apache.poi.poifs.filesystem.POIFSFileSystem; 
    public class exceltest {public static void writeexcel() throws IOException {
    HSSFWorkbook wb = new HSSFWorkbook();
    //建立新HSSFWorkbook对象
    HSSFSheet sheet = wb.createSheet("new sheet");
    //建立新的sheet对象 0 开始
    HSSFRow row = sheet.createRow((short)0);
    //建立新行
    HSSFCell cell = row.createCell((short)0);
    //建立新cell
    cell.setCellValue(3.3);//设置cell的整数类型的值
    row.createCell((short)1).setCellValue(1.2);
    //设置cell浮点类型的值
    row.createCell((short)2).setCellValue("test");
    //设置cell字符类型的值
    row.createCell((short)3).setCellValue(true);
    //设置cell布尔类型的值 
    HSSFCellStyle cellStyle = wb.createCellStyle();
    //建立新的cell样式
    cellStyle.setDataFormat
    (HSSFDataFormat.getBuiltinFormat("m/d/yy h:mm"));
    //设置cell样式为定制的日期格式
    HSSFCell dCell =row.createCell((short)4);
    dCell.setCellValue(new Date());
    //设置cell为日期类型的值
    dCell.setCellStyle(cellStyle); 
    //设置该cell日期的显示格式
    HSSFCell csCell =row.createCell((short)5);
    csCell.setEncoding(HSSFCell.ENCODING_UTF_16);
    //设置cell编码解决中文高位字节截断
    csCell.setCellValue("中文测试_Chinese Words Test");
    //设置中西文结合字符串
    row.createCell((short)6).setCellType
    (HSSFCell.CELL_TYPE_ERROR);
    //建立错误cell
    FileOutputStream fileOut = 
    new FileOutputStream("d:/workbook.xls");
    wb.write(fileOut);
    fileOut.close();
    System.out.println("hahaha");
    }
        public static void readexcel() {
           POIFSFileSystem fs = null; 
         HSSFWorkbook wb = null; 
         try { 
             fs = new POIFSFileSystem(new FileInputStream("d:/workbook.xls"));
             wb = new HSSFWorkbook(fs); 
             } catch (IOException e) { 
             e.printStackTrace(); 
             } 
             HSSFSheet sheet = wb.getSheetAt(0); 
             HSSFRow row = sheet.getRow(0); 
             HSSFCell cell = row.getCell((short)0); 
             double msg  = cell.getNumericCellValue();
             System.out.println(msg);
        //     String msg1  = cell.getCellFormula();
        //     System.out.println(msg1);
        
        }
        
    public static void main(String[] args) throws IOException {
    writeexcel();
           System.out.println("Write OK");
            readexcel();
            System.out.println("Read OK");
            
    }
      

  4.   

    用jxl  或者可以直接把excel当成数据库那样连接