// Create a new workbook Workbook workbook = new Workbook(); IWorksheet ws = workbook.getWorksheets().get(0); String data = "https://w1.weather.gov/xml/current_obs/KAKR.xml"; ws.getRange("A1").setValue(data); ws.getRange("A2").setFormula("=WEBSERVICE(A1)"); ws.getRange("A3").setValue("//location"); ws.getRange("A4").setValue("//observation_time"); ws.getRange("A5").setValue("//weather"); ws.getRange("A6").setValue("//temperature_string"); ws.getRange("A7").setFormula("=FILTERXML(A2,A3)"); ws.getRange("A8").setFormula("=FILTERXML(A2,A4)"); ws.getRange("A9").setFormula("=FILTERXML(A2,A5)"); ws.getRange("A10").setFormula("=FILTERXML(A2,A6)"); ws.getRange("A:A").getEntireColumn().autoFit(); // Save to an excel file workbook.save("WebServiceAndFilterXml.xlsx");