我必须将时间值从 Excel 插入到 mysql,如下图所示。
int punchin = (int) row.getCell(1).getNumericCellValue();
System.out.println("::::::::::::::::: "+punchin);
int punchout = (int) row.getCell(2).getNumericCellValue();
System.out.println("::::::::::::::::: "+punchout);
int duration = (int) row.getCell(3).getNumericCellValue();
System.out.println("::::::::::::::::: "+duration);
但我无法获得正确的值。
最佳答案
使用 MySQL for Excel:https://dev.mysql.com/downloads/windows/excel/
它真的很容易使用。安装完成后,在 Excel 中转到“数据”选项卡,最后将出现 Mysql for Excel。
假设您现在已经设置了与数据库的连接,那么您现在所要做的就是以下操作:
- 选择除列之外的所有数据。
- 在侧面板上,点击您要将数据放入其中的数据库表。
- 点击“将 Excel 数据附加到表格”。
- 使用此时提供的工具将数据中的任何列映射到数据库列。
- 点击“追加”并等待。
- 您的数据现在应该已上传。
关于mysql - 从excel表上传到mysql的时间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42083946/