title: How to use Apache POI to read spreadsheets with Google App Engine?
body: <p>I've been using <a href="http://jexcelapi.sourceforge.net/" rel="nofollow">JXL</a> for a while to process excel files from inside the webapp folder. This works in both development and production. I just inject a <code>ServletContext</code> and call something like:</p>
  
  <p><code>Workbook.getWorkbook(new File(servletContext.getRealPath("WEB-INF/myfile.xls")))</code> and JXL can read the file and process it.</p>
  
  <p>I recently switched to using <a href="http://poi.apache.org/index.html" rel="nofollow">Apache POI</a> in an App Engine Servlet but I get an exception:</p>
  
  <pre><code>[ERROR] java.security.AccessControlException: access denied ("java.io.FilePermission" "C:\Users\Drew\IntelliJ\UsavApp\target\UsavAppV7-1.0-SNAPSHOT\WEB-INF\myfile.xlsx" "write")
  [ERROR]     at java.security.AccessControlContext.checkPermission(AccessControlContext.java:372)
  [ERROR]     at java.security.AccessController.checkPermission(AccessController.java:559)
  [ERROR]     at java.lang.SecurityManager.checkPermission(SecurityManager.java:549)
  [ERROR]     at com.google.appengine.tools.development.DevAppServerFactory$CustomSecurityManager.checkPermission(DevAppServerFactory.java:429)
  [ERROR]     at java.lang.SecurityManager.checkWrite(SecurityManager.java:979)
  [ERROR]     at java.io.RandomAccessFile.&lt;init&gt;(RandomAccessFile.java:229)
  [ERROR]     at org.apache.poi.poifs.nio.FileBackedDataSource.newSrcFile(FileBackedDataSource.java:130)
  [ERROR]     at org.apache.poi.poifs.nio.FileBackedDataSource.&lt;init&gt;(FileBackedDataSource.java:46)
  [ERROR]     at org.apache.poi.poifs.filesystem.NPOIFSFileSystem.&lt;init&gt;(NPOIFSFileSystem.java:218)
  [ERROR]     at org.apache.poi.poifs.filesystem.NPOIFSFileSystem.&lt;init&gt;(NPOIFSFileSystem.java:166)
  [ERROR]     at org.apache.poi.ss.usermodel.WorkbookFactory.create(WorkbookFactory.java:278)
  [ERROR]     at org.apache.poi.ss.usermodel.WorkbookFactory.create(WorkbookFactory.java:250)
  [ERROR]     at org.apache.poi.ss.usermodel.WorkbookFactory.create(WorkbookFactory.java:229)
  [ERROR]     at com.utilitiessavings.usavappv7.server.handler.parse.ParseElecTariffBooksHandler.processTariffsFromExcel(ParseElecTariffBooksHandler.java:108)
  [ERROR]     at com.utilitiessavings.usavappv7.server.handler.parse.ParseElecTariffBooksHandler.execute(ParseElecTariffBooksHandler.java:91)
  [ERROR]     at com.utilitiessavings.usavappv7.server.handler.parse.ParseElecTariffBooksHandler.execute(ParseElecTariffBooksHandler.java:39)
  ...etc
  </code></pre>
  
  <p>From reading around I gather POI isn't totally compatible with GAE, but most people talk about creating files from scratch, or writing them to the local disk. I'm not doing either of those so I wanted to be sure this is a limitation of App Engine and not something I'm doing.</p>
  
  <p>My guess from the exception would be that POI needs write access even to read the file, whereas JXL didn't. <strong>Is there a way to read a spreadsheet in app engine using Apache POI?</strong></p>