{"id":439,"date":"2013-05-28T15:17:53","date_gmt":"2013-05-28T15:17:53","guid":{"rendered":"http:\/\/a1webdesignteam.com\/blog\/?p=439"},"modified":"2013-05-28T15:17:53","modified_gmt":"2013-05-28T15:17:53","slug":"read-write-excel-file-java-apache-poi","status":"publish","type":"post","link":"https:\/\/a1webdesignteam.com\/blog\/read-write-excel-file-java-apache-poi\/","title":{"rendered":"Read \/ Write Excel File In Java Using Apache POI"},"content":{"rendered":"<p>Apache POI is a powerful Java library to work with different Microsoft Office file formats such as Excel, Power point, Visio, MS Word etc. The name POI was originally an acronym for\u00a0<strong>Poor Obfuscation Implementation<\/strong>, referring humorously to the fact that the file formats seemed to be deliberately obfuscated, but poorly, since they were successfully reverse-engineered.<\/p>\n<p>In this tutorial we will use Apache POI library to perform different functions on Microsoft Excel spreadsheet.<\/p>\n<p>Let\u2019s get started.<\/p>\n<p><strong>Tools &amp; Technologies:<\/strong><\/p>\n<ol>\n<li>Java JDK 1.5 or above<\/li>\n<li>Apache POI library v3.8 or above (<a href=\"http:\/\/poi.apache.org\/download.html\">download<\/a>)<\/li>\n<li>Eclipse 3.2 above (optional)<\/li>\n<\/ol>\n<h2>1. Add Apache POI dependency<\/h2>\n<p>Make sure to include apache poi jar file to your project. If your project uses Maven as dependency management, add following in your Pom.xml file.<\/p>\n<div>\n<div id=\"highlighter_467828\">\n<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td>\n<div>\n<div><code>&lt;<\/code><code>dependency<\/code><code>&gt;<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0<\/code><code>&lt;<\/code><code>groupId<\/code><code>&gt;org.apache.poi&lt;\/<\/code><code>groupId<\/code><code>&gt;<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0<\/code><code>&lt;<\/code><code>artifactId<\/code><code>&gt;poi&lt;\/<\/code><code>artifactId<\/code><code>&gt;<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0<\/code><code>&lt;<\/code><code>version<\/code><code>&gt;3.8&lt;\/<\/code><code>version<\/code><code>&gt;<\/code><\/div>\n<div><code>&lt;\/<\/code><code>dependency<\/code><code>&gt;<\/code><\/div>\n<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p>If you are not using Maven then you can directly add required JAR files in your classpath.<\/p>\n<ol>\n<li>Download\u00a0<code>poi-2.5.1.jar<\/code>(or in this case 3.8) jar file.<\/li>\n<li>Include this file in your projects class path.<\/li>\n<li>Create new java project in eclipse with auto generated main function.<\/li>\n<\/ol>\n<h2>2. Read Excel File<\/h2>\n<p>To read an excel file, Apache POI provides certain easy-to-use APIs. In below sample code we use different classes from POI library to read content of cell from excel file. This is for quick reference.<\/p>\n<div>\n<div id=\"highlighter_70698\">\n<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td>\n<div>\n<div><code>import<\/code> <code>org.apache.poi.hssf.usermodel.HSSFSheet;<\/code><\/div>\n<div><code>import<\/code> <code>org.apache.poi.hssf.usermodel.HSSFWorkbook;<\/code><\/div>\n<div><code>\/\/..<\/code><\/div>\n<div><code>FileInputStream file = <\/code><code>new<\/code> <code>FileInputStream(<\/code><code>new<\/code> <code>File(<\/code><code>\"C:\\\\test.xls\"<\/code><code>));<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code><\/div>\n<div><code>\/\/Get the workbook instance for XLS file <\/code><\/div>\n<div><code>HSSFWorkbook workbook = <\/code><code>new<\/code> <code>HSSFWorkbook(file);<\/code><\/div>\n<div><\/div>\n<div><code>\/\/Get first sheet from the workbook<\/code><\/div>\n<div><code>HSSFSheet sheet = workbook.getSheetAt(<\/code><code>0<\/code><code>);<\/code><\/div>\n<div><\/div>\n<div><code>\/\/Get iterator to all the rows in current sheet<\/code><\/div>\n<div><code>Iterator&lt;Row&gt; rowIterator = sheet.iterator();<\/code><\/div>\n<div><\/div>\n<div><code>\/\/Get iterator to all cells of current row<\/code><\/div>\n<div><code>Iterator&lt;Cell&gt; cellIterator = row.cellIterator();<\/code><\/div>\n<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p>Notice how each class in POI library starts with\u00a0<strong>HSSF<\/strong>\u00a0prefix! e.g. HSSFWorkbook, HSSFSheet etc. HSSF stands for\u00a0<strong>Horrible SpreadSheet Format<\/strong>! I\u2019m not kidding.. It really is.<\/p>\n<p>Similar to HSSF, POI has different prefix for other file formats too:<\/p>\n<ol>\n<li>HSSF (Horrible SpreadSheet Format) \u2013 reads and writes Microsoft Excel (XLS) format files.<\/li>\n<li>XSSF (XML SpreadSheet Format) \u2013 reads and writes Office Open XML (XLSX) format files.<\/li>\n<li>HPSF (Horrible Property Set Format) \u2013 reads \u201cDocument Summary\u201d information from Microsoft Office files.<\/li>\n<li>HWPF (Horrible Word Processor Format) \u2013 aims to read and write Microsoft Word 97 (DOC) format files.<\/li>\n<li>HSLF (Horrible Slide Layout Format) \u2013 a pure Java implementation for Microsoft PowerPoint files.<\/li>\n<li>HDGF (Horrible DiaGram Format) \u2013 an initial pure Java implementation for Microsoft Visio binary files.<\/li>\n<li>HPBF (Horrible PuBlisher Format) \u2013 a pure Java implementation for Microsoft Publisher files.<\/li>\n<li>HSMF (Horrible Stupid Mail Format) \u2013 a pure Java implementation for Microsoft Outlook MSG files<\/li>\n<li>DDF (Dreadful Drawing Format) \u2013 a package for decoding the Microsoft Office Drawing format.<\/li>\n<\/ol>\n<p>Consider a sample excel file:<\/p>\n<p><em>test.xls<\/em><br \/>\n<img loading=\"lazy\" title=\"excel-file\" alt=\"java read excel file\" src=\"http:\/\/img.viralpatel.net\/2012\/11\/excel-file.png\" width=\"380\" height=\"169\" \/><\/p>\n<p>We will read above xls file using Apache POI and prints the data.<\/p>\n<div>\n<div id=\"highlighter_712280\">\n<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td>\n<div>\n<div><code>try<\/code> <code>{<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0<\/code><code>FileInputStream file = <\/code><code>new<\/code> <code>FileInputStream(<\/code><code>new<\/code> <code>File(<\/code><code>\"C:\\\\test.xls\"<\/code><code>));<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0<\/code><code>\/\/Get the workbook instance for XLS file <\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0<\/code><code>HSSFWorkbook workbook = <\/code><code>new<\/code> <code>HSSFWorkbook(file);<\/code><\/div>\n<div><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0<\/code><code>\/\/Get first sheet from the workbook<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0<\/code><code>HSSFSheet sheet = workbook.getSheetAt(<\/code><code>0<\/code><code>);<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0<\/code><code>\/\/Iterate through each rows from first sheet<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0<\/code><code>Iterator&lt;Row&gt; rowIterator = sheet.iterator();<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0<\/code><code>while<\/code><code>(rowIterator.hasNext()) {<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code><code>Row row = rowIterator.next();<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code><code>\/\/For each row, iterate through each columns<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code><code>Iterator&lt;Cell&gt; cellIterator = row.cellIterator();<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code><code>while<\/code><code>(cellIterator.hasNext()) {<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code><code>Cell cell = cellIterator.next();<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code><code>switch<\/code><code>(cell.getCellType()) {<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code><code>case<\/code> <code>Cell.CELL_TYPE_BOOLEAN:<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code><code>System.out.print(cell.getBooleanCellValue() + <\/code><code>\"\\t\\t\"<\/code><code>);<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code><code>break<\/code><code>;<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code><code>case<\/code> <code>Cell.CELL_TYPE_NUMERIC:<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code><code>System.out.print(cell.getNumericCellValue() + <\/code><code>\"\\t\\t\"<\/code><code>);<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code><code>break<\/code><code>;<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code><code>case<\/code> <code>Cell.CELL_TYPE_STRING:<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code><code>System.out.print(cell.getStringCellValue() + <\/code><code>\"\\t\\t\"<\/code><code>);<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code><code>break<\/code><code>;<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code><code>}<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code><code>}<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code><code>System.out.println(<\/code><code>\"\"<\/code><code>);<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0<\/code><code>}<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0<\/code><code>file.close();<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0<\/code><code>FileOutputStream out = <\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code><code>new<\/code> <code>FileOutputStream(<\/code><code>new<\/code> <code>File(<\/code><code>\"C:\\\\test.xls\"<\/code><code>));<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0<\/code><code>workbook.write(out);<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0<\/code><code>out.close();<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0<\/code><\/div>\n<div><code>} <\/code><code>catch<\/code> <code>(FileNotFoundException e) {<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0<\/code><code>e.printStackTrace();<\/code><\/div>\n<div><code>} <\/code><code>catch<\/code> <code>(IOException e) {<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0<\/code><code>e.printStackTrace();<\/code><\/div>\n<div><code>}<\/code><\/div>\n<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p>The above code is self explanatory. It read the sheet from workbook and iterate through each row and cell to print its values. Just note how we use different methods like\u00a0<code>getBooleanCellValue<\/code>,<code>getNumericCellValue<\/code>\u00a0etc to read cell value. Before reading a cell content, we need to first determine its type using method\u00a0<code>cell.getCellType()<\/code>\u00a0and then call appropriate method to read content.<\/p>\n<p><strong>Output:<\/strong><\/p>\n<div>\n<div id=\"highlighter_41301\">\n<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td>\n<div>\n<div><code>Emp Id\u00a0\u00a0\u00a0\u00a0\u00a0 Name\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Salary\u00a0\u00a0\u00a0\u00a0\u00a0 <\/code><\/div>\n<div><code>1.0\u00a0\u00a0\u00a0\u00a0 John\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 2000000.0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/code><\/div>\n<div><code>2.0\u00a0\u00a0\u00a0\u00a0 Dean\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 420000.0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/code><\/div>\n<div><code>3.0\u00a0\u00a0\u00a0\u00a0 Sam\u00a0\u00a0\u00a0\u00a0 280000.0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/code><\/div>\n<div><code>4.0\u00a0\u00a0\u00a0\u00a0 Cass\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 6000000.0\u00a0\u00a0 <\/code><\/div>\n<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<h2>3. Create New Excel File<\/h2>\n<p>Let us create a new excel file and write data in it. Following is the API which we will use for this purpose.<\/p>\n<div>\n<div id=\"highlighter_998892\">\n<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td>\n<div>\n<div><code>import<\/code> <code>org.apache.poi.hssf.usermodel.HSSFSheet;<\/code><\/div>\n<div><code>import<\/code> <code>org.apache.poi.hssf.usermodel.HSSFWorkbook;<\/code><\/div>\n<div><code>\/\/..<\/code><\/div>\n<div><code>HSSFWorkbook workbook = <\/code><code>new<\/code> <code>HSSFWorkbook();<\/code><\/div>\n<div><code>HSSFSheet sheet = workbook.createSheet(<\/code><code>\"Sample sheet\"<\/code><code>);<\/code><\/div>\n<div><code>\/\/Create a new row in current sheet<\/code><\/div>\n<div><code>Row row = sheet.createRow(<\/code><code>0<\/code><code>);<\/code><\/div>\n<div><code>\/\/Create a new cell in current row<\/code><\/div>\n<div><code>Cell cell = row.createCell(<\/code><code>0<\/code><code>);<\/code><\/div>\n<div><code>\/\/Set value to new value<\/code><\/div>\n<div><code>cell.setCellValue(<\/code><code>\"Blahblah\"<\/code><code>);<\/code><\/div>\n<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p>Below is the complete code that writes a new excel with dummy data:<\/p>\n<div>\n<div id=\"highlighter_628577\">\n<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td>\n<div>\n<div><code>HSSFWorkbook workbook = <\/code><code>new<\/code> <code>HSSFWorkbook();<\/code><\/div>\n<div><code>HSSFSheet sheet = workbook.createSheet(<\/code><code>\"Sample sheet\"<\/code><code>);<\/code><\/div>\n<div><\/div>\n<div><code>Map&lt;String, Object[]&gt; data = <\/code><code>new<\/code> <code>HashMap&lt;String, Object[]&gt;();<\/code><\/div>\n<div><code>data.put(<\/code><code>\"1\"<\/code><code>, <\/code><code>new<\/code> <code>Object[] {<\/code><code>\"Emp No.\"<\/code><code>, <\/code><code>\"Name\"<\/code><code>, <\/code><code>\"Salary\"<\/code><code>});<\/code><\/div>\n<div><code>data.put(<\/code><code>\"2\"<\/code><code>, <\/code><code>new<\/code> <code>Object[] {1d, <\/code><code>\"John\"<\/code><code>, 1500000d});<\/code><\/div>\n<div><code>data.put(<\/code><code>\"3\"<\/code><code>, <\/code><code>new<\/code> <code>Object[] {2d, <\/code><code>\"Sam\"<\/code><code>, 800000d});<\/code><\/div>\n<div><code>data.put(<\/code><code>\"4\"<\/code><code>, <\/code><code>new<\/code> <code>Object[] {3d, <\/code><code>\"Dean\"<\/code><code>, 700000d});<\/code><\/div>\n<div><\/div>\n<div><code>Set&lt;String&gt; keyset = data.keySet();<\/code><\/div>\n<div><code>int<\/code> <code>rownum = <\/code><code>0<\/code><code>;<\/code><\/div>\n<div><code>for<\/code> <code>(String key : keyset) {<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0<\/code><code>Row row = sheet.createRow(rownum++);<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0<\/code><code>Object [] objArr = data.get(key);<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0<\/code><code>int<\/code> <code>cellnum = <\/code><code>0<\/code><code>;<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0<\/code><code>for<\/code> <code>(Object obj : objArr) {<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code><code>Cell cell = row.createCell(cellnum++);<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code><code>if<\/code><code>(obj <\/code><code>instanceof<\/code> <code>Date) <\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code><code>cell.setCellValue((Date)obj);<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code><code>else<\/code> <code>if<\/code><code>(obj <\/code><code>instanceof<\/code> <code>Boolean)<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code><code>cell.setCellValue((Boolean)obj);<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code><code>else<\/code> <code>if<\/code><code>(obj <\/code><code>instanceof<\/code> <code>String)<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code><code>cell.setCellValue((String)obj);<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code><code>else<\/code> <code>if<\/code><code>(obj <\/code><code>instanceof<\/code> <code>Double)<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code><code>cell.setCellValue((Double)obj);<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0<\/code><code>}<\/code><\/div>\n<div><code>}<\/code><\/div>\n<div><\/div>\n<div><code>try<\/code> <code>{<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0<\/code><code>FileOutputStream out = <\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code><code>new<\/code> <code>FileOutputStream(<\/code><code>new<\/code> <code>File(<\/code><code>\"C:\\\\new.xls\"<\/code><code>));<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0<\/code><code>workbook.write(out);<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0<\/code><code>out.close();<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0<\/code><code>System.out.println(<\/code><code>\"Excel written successfully..\"<\/code><code>);<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0<\/code><\/div>\n<div><code>} <\/code><code>catch<\/code> <code>(FileNotFoundException e) {<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0<\/code><code>e.printStackTrace();<\/code><\/div>\n<div><code>} <\/code><code>catch<\/code> <code>(IOException e) {<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0<\/code><code>e.printStackTrace();<\/code><\/div>\n<div><code>}<\/code><\/div>\n<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p><strong>Output:<\/strong>\u00a0<em>new.xls<\/em><br \/>\n<img loading=\"lazy\" title=\"java-write-excel\" alt=\"java-write-excel file\" src=\"http:\/\/img.viralpatel.net\/2012\/11\/java-write-excel.png\" width=\"376\" height=\"164\" \/><\/p>\n<h2>4. Update Existing Excel File<\/h2>\n<p>Updating an existing excel file is straight forward. Open the excel using different API that we discussed above and set the cell\u2019s value. One thing we need to note here is that we can update the excel file only when we close it first.<\/p>\n<p><em>update.xls<\/em><br \/>\n<img loading=\"lazy\" title=\"java-update-excel-before\" alt=\"java-update-excel-before\" src=\"http:\/\/img.viralpatel.net\/2012\/11\/java-update-excel-before.png\" width=\"343\" height=\"134\" \/><\/p>\n<p>Following Java code read the above excel file and doubles the salary of each employee:<\/p>\n<div>\n<div id=\"highlighter_811848\">\n<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td>\n<div>\n<div><code>try<\/code> <code>{<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0<\/code><code>FileInputStream file = <\/code><code>new<\/code> <code>FileInputStream(<\/code><code>new<\/code> <code>File(<\/code><code>\"C:\\\\update.xls\"<\/code><code>));<\/code><\/div>\n<div><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0<\/code><code>HSSFWorkbook workbook = <\/code><code>new<\/code> <code>HSSFWorkbook(file);<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0<\/code><code>HSSFSheet sheet = workbook.getSheetAt(<\/code><code>0<\/code><code>);<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0<\/code><code>Cell cell = <\/code><code>null<\/code><code>;<\/code><\/div>\n<div><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0<\/code><code>\/\/Update the value of cell<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0<\/code><code>cell = sheet.getRow(<\/code><code>1<\/code><code>).getCell(<\/code><code>2<\/code><code>);<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0<\/code><code>cell.setCellValue(cell.getNumericCellValue() * <\/code><code>2<\/code><code>);<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0<\/code><code>cell = sheet.getRow(<\/code><code>2<\/code><code>).getCell(<\/code><code>2<\/code><code>);<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0<\/code><code>cell.setCellValue(cell.getNumericCellValue() * <\/code><code>2<\/code><code>);<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0<\/code><code>cell = sheet.getRow(<\/code><code>3<\/code><code>).getCell(<\/code><code>2<\/code><code>);<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0<\/code><code>cell.setCellValue(cell.getNumericCellValue() * <\/code><code>2<\/code><code>);<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0<\/code><code>file.close();<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0<\/code><code>FileOutputStream outFile =<\/code><code>new<\/code> <code>FileOutputStream(<\/code><code>new<\/code> <code>File(<\/code><code>\"C:\\\\update.xls\"<\/code><code>));<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0<\/code><code>workbook.write(outFile);<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0<\/code><code>outFile.close();<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0<\/code><\/div>\n<div><code>} <\/code><code>catch<\/code> <code>(FileNotFoundException e) {<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0<\/code><code>e.printStackTrace();<\/code><\/div>\n<div><code>} <\/code><code>catch<\/code> <code>(IOException e) {<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0<\/code><code>e.printStackTrace();<\/code><\/div>\n<div><code>}<\/code><\/div>\n<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p>Steps to update excel file will be:<\/p>\n<ol>\n<li>Open excel file in input mode (inputstream)<\/li>\n<li>Use POI API and read the excel content<\/li>\n<li>Update cell\u2019s value using different\u00a0<code>setCellValue<\/code>\u00a0methods.<\/li>\n<li>Close the excel input file (inputstream)<\/li>\n<li>Open same excel file in output mode (outputstream)<\/li>\n<li>Write content of updated workbook in output file<\/li>\n<li>Close output excel file<\/li>\n<\/ol>\n<p><strong>Output:<\/strong>\u00a0<em>update.xls<\/em><br \/>\n<img loading=\"lazy\" title=\"java-update-excel-after\" alt=\"java-update-excel-after\" src=\"http:\/\/img.viralpatel.net\/2012\/11\/java-update-excel-after.png\" width=\"329\" height=\"132\" \/><\/p>\n<h2>5. Adding Formulas<\/h2>\n<p>Apache POI provides API to add excel formulas to cell programmatically. Following method that comes handy for this:<\/p>\n<div>\n<div id=\"highlighter_621015\">\n<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td>\n<div>\n<div><code>cell.setCellFormula(<\/code><code>\"someformula\"<\/code><code>)<\/code><\/div>\n<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p>For example:<\/p>\n<div>\n<div id=\"highlighter_532751\">\n<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td>\n<div>\n<div><code>cell.setCellFormula(<\/code><code>\"A2*B2*C5\"<\/code><code>)<\/code><\/div>\n<div><code>\/\/or<\/code><\/div>\n<div><code>cell.setCellFormula(<\/code><code>\"SUM(A1:A7)\"<\/code><code>)<\/code><\/div>\n<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p><strong>Note:<\/strong>\u00a0Formula string should not start with equal sign (=)<br \/>\nThus, following is incorrect way of adding formula:<\/p>\n<div>\n<div id=\"highlighter_250329\">\n<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td>\n<div>\n<div><code>cell.setCellFormula(<\/code><code>\"=A2*B2*C5\"<\/code><code>) <\/code><code>\/\/Ops! Won't work<\/code><\/div>\n<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p>The above code will throw:<\/p>\n<div>\n<div id=\"highlighter_585624\">\n<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td>\n<div>\n<div><code>org.apache.poi.ss.formula.FormulaParseException: <\/code><\/div>\n<div><code>The specified formula '=A2*B2*C5' starts with an equals sign which is not allowed.<\/code><\/div>\n<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p>Following Java code creates a new excel sheet which calculates Simple Interest. It defines Principal amount, Rate of Interest and Tenure. We add an excel formula to calculate interest.<\/p>\n<div>\n<div id=\"highlighter_271660\">\n<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td>\n<div>\n<div><code>HSSFWorkbook workbook = <\/code><code>new<\/code> <code>HSSFWorkbook();<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0<\/code><code>HSSFSheet sheet = workbook.createSheet(<\/code><code>\"Calculate Simple Interest\"<\/code><code>);<\/code><\/div>\n<div><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0<\/code><code>Row header = sheet.createRow(<\/code><code>0<\/code><code>);<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0<\/code><code>header.createCell(<\/code><code>0<\/code><code>).setCellValue(<\/code><code>\"Pricipal Amount (P)\"<\/code><code>);<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0<\/code><code>header.createCell(<\/code><code>1<\/code><code>).setCellValue(<\/code><code>\"Rate of Interest (r)\"<\/code><code>);<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0<\/code><code>header.createCell(<\/code><code>2<\/code><code>).setCellValue(<\/code><code>\"Tenure (t)\"<\/code><code>);<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0<\/code><code>header.createCell(<\/code><code>3<\/code><code>).setCellValue(<\/code><code>\"Interest (P r t)\"<\/code><code>);<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0<\/code><code>Row dataRow = sheet.createRow(<\/code><code>1<\/code><code>);<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0<\/code><code>dataRow.createCell(<\/code><code>0<\/code><code>).setCellValue(14500d);<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0<\/code><code>dataRow.createCell(<\/code><code>1<\/code><code>).setCellValue(<\/code><code>9.25<\/code><code>);<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0<\/code><code>dataRow.createCell(<\/code><code>2<\/code><code>).setCellValue(3d);<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0<\/code><code>dataRow.createCell(<\/code><code>3<\/code><code>).setCellFormula(<\/code><code>\"A2*B2*C2\"<\/code><code>);<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0<\/code><code>try<\/code> <code>{<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code><code>FileOutputStream out = <\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code><code>new<\/code> <code>FileOutputStream(<\/code><code>new<\/code> <code>File(<\/code><code>\"C:\\\\formula.xls\"<\/code><code>));<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code><code>workbook.write(out);<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code><code>out.close();<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code><code>System.out.println(<\/code><code>\"Excel written successfully..\"<\/code><code>);<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0<\/code><code>} <\/code><code>catch<\/code> <code>(FileNotFoundException e) {<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code><code>e.printStackTrace();<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0<\/code><code>} <\/code><code>catch<\/code> <code>(IOException e) {<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code><code>e.printStackTrace();<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0<\/code><code>}<\/code><\/div>\n<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p><strong>Output:<\/strong>\u00a0<em>formula.xls<\/em><br \/>\n<img loading=\"lazy\" title=\"java-excel-add-formula\" alt=\"java-excel-add-formula\" src=\"http:\/\/img.viralpatel.net\/2012\/11\/java-excel-add-formula.png\" width=\"473\" height=\"200\" \/><\/p>\n<h4>Triggering Existing Excel Formulas<\/h4>\n<p>In certain cases your excel file might have formula defined and you may want to trigger those formulas since you updated it using POI. Following code snippet will do the trick.<\/p>\n<div>\n<div id=\"highlighter_768788\">\n<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td>\n<div>\n<div><code>FileInputStream fis = <\/code><code>new<\/code> <code>FileInputStream(<\/code><code>\"\/somepath\/test.xls\"<\/code><code>);<\/code><\/div>\n<div><code>Workbook wb = <\/code><code>new<\/code> <code>HSSFWorkbook(fis); <\/code><code>\/\/or new XSSFWorkbook(\"C:\\\\test.xls\")<\/code><\/div>\n<div><code>FormulaEvaluator evaluator = wb.getCreationHelper().createFormulaEvaluator();<\/code><\/div>\n<div><code>for<\/code><code>(<\/code><code>int<\/code> <code>sheetNum = <\/code><code>0<\/code><code>; sheetNum &lt; wb.getNumberOfSheets(); sheetNum++) {<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0<\/code><code>Sheet sheet = wb.getSheetAt(sheetNum);<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0<\/code><code>for<\/code><code>(Row r : sheet) {<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code><code>for<\/code><code>(Cell c : r) {<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code><code>if<\/code><code>(c.getCellType() == Cell.CELL_TYPE_FORMULA) {<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code><code>evaluator.evaluateFormulaCell(c);<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code><code>}<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code><code>}<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0<\/code><code>}<\/code><\/div>\n<div><code>}<\/code><\/div>\n<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p>We use\u00a0<code>FormulaEvaluator<\/code>\u00a0class to evaluate formula defined in each of the cell.<\/p>\n<h2>6. Adding Styles to Cell<\/h2>\n<p>Adding style to a cell is also piece of cake. Check following example which creates two new cell one with bold font and another with italic and add text to it.<\/p>\n<div>\n<div id=\"highlighter_401720\">\n<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td>\n<div>\n<div><code>HSSFWorkbook workbook = <\/code><code>new<\/code> <code>HSSFWorkbook();<\/code><\/div>\n<div><code>HSSFSheet sheet = workbook.createSheet(<\/code><code>\"Style example\"<\/code><code>);<\/code><\/div>\n<div><\/div>\n<div><code>HSSFFont font = workbook.createFont();<\/code><\/div>\n<div><code>font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);<\/code><\/div>\n<div><code>HSSFCellStyle style = workbook.createCellStyle();<\/code><\/div>\n<div><code>style.setFont(font);<\/code><\/div>\n<div><\/div>\n<div><code>Row row = sheet.createRow(<\/code><code>0<\/code><code>);<\/code><\/div>\n<div><code>Cell cell = row.createCell(<\/code><code>0<\/code><code>);<\/code><\/div>\n<div><code>cell.setCellValue(<\/code><code>\"This is bold\"<\/code><code>);<\/code><\/div>\n<div><code>cell.setCellStyle(style);<\/code><\/div>\n<div><\/div>\n<div><\/div>\n<div><code>font = workbook.createFont();<\/code><\/div>\n<div><code>font.setItalic(<\/code><code>true<\/code><code>);<\/code><\/div>\n<div><code>style = workbook.createCellStyle();<\/code><\/div>\n<div><code>style.setFont(font);<\/code><\/div>\n<div><\/div>\n<div><code>row = sheet.createRow(<\/code><code>1<\/code><code>);<\/code><\/div>\n<div><code>cell = row.createCell(<\/code><code>0<\/code><code>);<\/code><\/div>\n<div><code>cell.setCellValue(<\/code><code>\"This is italic\"<\/code><code>);<\/code><\/div>\n<div><code>cell.setCellStyle(style);<\/code><\/div>\n<div><\/div>\n<div><code>try<\/code> <code>{<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0<\/code><code>FileOutputStream out = <\/code><code>new<\/code> <code>FileOutputStream(<\/code><code>new<\/code> <code>File(<\/code><code>\"C:\\\\style.xls\"<\/code><code>));<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0<\/code><code>workbook.write(out);<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0<\/code><code>out.close();<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0<\/code><code>System.out.println(<\/code><code>\"Excel written successfully..\"<\/code><code>);<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0<\/code><\/div>\n<div><code>} <\/code><code>catch<\/code> <code>(FileNotFoundException e) {<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0<\/code><code>e.printStackTrace();<\/code><\/div>\n<div><code>} <\/code><code>catch<\/code> <code>(IOException e) {<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0<\/code><code>e.printStackTrace();<\/code><\/div>\n<div><code>}<\/code><\/div>\n<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p><strong>Output:<\/strong>\u00a0<em>style.xls<\/em><br \/>\n<img loading=\"lazy\" title=\"java-excel-cell-style\" alt=\"java-excel-cell-style\" src=\"http:\/\/img.viralpatel.net\/2012\/11\/java-excel-cell-style.png\" width=\"299\" height=\"169\" \/><\/p>\n<p>I hope this article is useful.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Apache POI is a powerful Java library to work with different Microsoft Office file formats such as Excel, Power point, Visio, MS Word etc. The name POI was originally an acronym for\u00a0Poor Obfuscation Implementation, referring humorously to the fact that the file formats seemed to be deliberately obfuscated, but poorly, since they were successfully reverse-engineered. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0},"categories":[25],"tags":[],"_links":{"self":[{"href":"https:\/\/a1webdesignteam.com\/blog\/wp-json\/wp\/v2\/posts\/439"}],"collection":[{"href":"https:\/\/a1webdesignteam.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/a1webdesignteam.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/a1webdesignteam.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/a1webdesignteam.com\/blog\/wp-json\/wp\/v2\/comments?post=439"}],"version-history":[{"count":0,"href":"https:\/\/a1webdesignteam.com\/blog\/wp-json\/wp\/v2\/posts\/439\/revisions"}],"wp:attachment":[{"href":"https:\/\/a1webdesignteam.com\/blog\/wp-json\/wp\/v2\/media?parent=439"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/a1webdesignteam.com\/blog\/wp-json\/wp\/v2\/categories?post=439"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/a1webdesignteam.com\/blog\/wp-json\/wp\/v2\/tags?post=439"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}