i have a data in excel sheet that i need to read in java, i am able to read normal content but not able to read the json structure that i have stored. how can i parse json from excel to java?
public class JavaApplication1 {
public static void main(String[] args) {
try {
for (int i=0;i<5;i++)
{
FileInputStream fileInputStream = new FileInputStream("C://users/user/Desktop/C.xls");
HSSFWorkbook workbook = new HSSFWorkbook(fileInputStream);
HSSFSheet worksheet = workbook.getSheet("POI Worksheet");
HSSFRow row1 = worksheet.getRow(0);
HSSFCell cellC1 = row1.getCell((short) 2);
String c1Val = cellC1.getStringCellValue();
HSSFCell cellD1 = row1.getCell((short) 3);
double d1Val = cellD1.getNumericCellValue();
HSSFCell cellE1 = row1.getCell((short) 4);
String e1Val = cellE1.getStringCellValue();
System.out.println("C1: " + c1Val);
System.out.println("D1: " + d1Val);
System.out.println("E1: " + e1Val);
JSONObject obj = new JSONObject();
obj.put("name", new c1Val);
System.out.print(obj);
}
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
}
my excel sheet contains the following json:
A B C D E
1 rap {"type":"int", "minimum":15, "maximum":58} 240 delhi
this data needs to be read, from column c i need to read a single variable from 15 to 58.. how can i do this?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…