Created
October 6, 2019 06:22
-
-
Save sae13/89006ff3102689b03a2c94d5dc2b94f9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void getUserName(String xlsLocation) throws IOException { | |
FileInputStream file = new FileInputStream( new File(xlsLocation)); | |
Workbook workbook = new XSSFWorkbook(file); | |
Sheet sheet = workbook.getSheetAt(0); | |
for(Row row: sheet) | |
{ | |
Cell tenCell = row.getCell(0); | |
tenCell.setCellType(CellType.STRING); | |
Cell sixCell = row.getCell(1); | |
sixCell.setCellType(CellType.STRING); | |
try { | |
String email = getEmail(Integer.parseInt(sixCell.getStringCellValue())); | |
Cell emailCell = row.createCell(2); | |
if (email != null) { | |
emailCell.setCellValue(email); | |
} | |
} | |
catch (Exception e){ | |
e.printStackTrace(); | |
} | |
} | |
workbook.write(new FileOutputStream("/tmp/2.xlsx")); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment