Selenium Webdriver - Java - Exception on trying to write data in Excel using Apache POI
<p><a href="https://i.stack.imgur.com/s3o1p.png" rel="nofollow noreferrer">Jar Files</a></p>

<p>I'm trying to write a value to existing excel, While trying to run I'm getting below exception. Can someone guide please</p>

<pre><code>    Exception in thread "main" java.io.IOException: Failed to read zip entry source
at org.apache.poi.openxml4j.opc.ZipPackage.&lt;init&gt;(ZipPackage.java:106)
at org.apache.poi.openxml4j.opc.OPCPackage.open(OPCPackage.java:342)
at org.apache.poi.util.PackageHelper.open(PackageHelper.java:37)
at org.apache.poi.xssf.usermodel.XSSFWorkbook.&lt;init&gt;(XSSFWorkbook.java:285)
at samplescripts.WriteExcel.main(WriteExcel.java:19)
    Caused by: java.io.EOFException: Unexpected end of ZLIB input stream
at java.util.zip.InflaterInputStream.fill(Unknown Source)
at java.util.zip.InflaterInputStream.read(Unknown Source)
at java.util.zip.ZipInputStream.read(Unknown Source)
at org.apache.poi.openxml4j.util.ZipSecureFile$ThresholdInputStream.read(ZipSecureFile.java:213)
at java.io.FilterInputStream.read(Unknown Source)
at org.apache.poi.openxml4j.util.ZipInputStreamZipEntrySource$FakeZipEntry.&lt;init&gt;(ZipInputStreamZipEntrySource.java:132)
at org.apache.poi.openxml4j.util.ZipInputStreamZipEntrySource.&lt;init&gt;(ZipInputStreamZipEntrySource.java:56)
at org.apache.poi.openxml4j.opc.ZipPackage.&lt;init&gt;(ZipPackage.java:99)
... 4 more
</code></pre>

<p>Below is the code that Is used</p>

<pre><code>     package samplescripts;
     import java.io.File;
     import java.io.FileInputStream;
     import java.io.FileOutputStream;
     import org.apache.poi.xssf.usermodel.XSSFSheet;
     import org.apache.poi.xssf.usermodel.XSSFWorkbook;
     public class WriteExcel {
     public static void main(String[] args) throws Exception {
     // TODO Auto-generated method stub
     File src=new File("C:\\Selenium\\ExcelData\\TestData.xlsx");
     FileInputStream fis=new FileInputStream(src);
     XSSFWorkbook wb=new XSSFWorkbook(fis);
     XSSFSheet sheet1=wb.getSheetAt(0);
     sheet1.getRow(0).createCell(2).setCellValue("Pass");
     sheet1.getRow(1).createCell(2).setCellValue("Fail");
     sheet1.getRow(2).createCell(2).setCellValue("14.12");
     FileOutputStream fout=new FileOutputStream(src);
     wb.write(fout);
     wb.close();
     }
     }
</code></pre>