如何在.xls文件(excel工作表)中获取特定列并在jtabel中显示,以及使用netbeans在java中存储在mysql数据库中
我正在做一个项目,一个星期以来一直没有找到任何解决方案。我必须上传excel sheet.xls和软件,获取.xls文件(excel sheet)中的特定列,并在jtabel中显示数据,同时使用netbeans将数据存储在java中的mysql数据库中。我的代码如何在.xls文件(excel工作表)中获取特定列并在jtabel中显示,以及使用netbeans在java中存储在mysql数据库中,java,excel,Java,Excel,我正在做一个项目,一个星期以来一直没有找到任何解决方案。我必须上传excel sheet.xls和软件,获取.xls文件(excel sheet)中的特定列,并在jtabel中显示数据,同时使用netbeans将数据存储在java中的mysql数据库中。我的代码 public String ReadCellData(int vRow, int vColumn) { String value; //variable for storing the cell value
public String ReadCellData(int vRow, int vColumn)
{
String value; //variable for storing the cell value
Workbook wb=null; //initialize Workbook null
try
{
//reading data from a file in the form of bytes
FileInputStream fis=new FileInputStream("D:\\Upwork Projects\\TakeOff software by martin\\QUOTE_SCOPE.xls");
//constructs an XSSFWorkbook object, by buffering the whole stream into the memory
wb=new HSSFWorkbook(fis);
}
catch(FileNotFoundException e)
{
}
catch(IOException e1)
{
}
Sheet sheet=wb.getSheetAt(0); //getting the HSSFSheet object at given index
Row row=sheet.getRow(vRow); //returns the logical row
Cell cell=row.getCell(vColumn); //getting the cell representing the given column
value=cell.getStringCellValue(); //getting cell value
return value;
//returns the cell value
}
数据库代码尚未编写,请帮助我编写mysql数据库代码,或者让我知道我必须更改完整的代码,或者不更改您的代码,我怀疑您已经尝试使用Apache POI。但是你的问题到底出在哪里呢?从你的代码来看,我怀疑你已经尝试过使用ApachePOI了。但你的问题到底在哪里?