title: How to create an excel file in android?
body: <p>I have to create an excel file programatically. Is there is any API to create an excel file or some other ways?<br>
  <b>EDIT on 7th Nov 2011</b><br>
  I tried example Create an Excel Spreadsheet from this link <a href="https://www.vogella.com/tutorials/JavaExcel/article.html" rel="nofollow noreferrer">Create an Excel spredsheet</a> <br> and I am getting NullPointerException at <code>workbook.write();</code>, Using this I can create excel file on SD card, but when I open that excel file using MS office 2007 I am getting <code>Unable to read file</code> message<br>
  Here the stack trace, <code>ExcelStudy</code> is my activity that uses <code>WriteExcel</code> class   </p>
  
  <pre><code>W/System.err(  235): java.lang.NullPointerException
  W/System.err(  235):    at jxl.biff.StringHelper.getUnicodeBytes(StringHelper.java:133)
  W/System.err(  235):    at jxl.biff.FontRecord.getData(FontRecord.java:289)
  W/System.err(  235):    at jxl.biff.WritableRecordData.getBytes(WritableRecordData.java:71)
  W/System.err(  235):    at jxl.write.biff.File.write(File.java:132)
  W/System.err(  235):    at jxl.biff.Fonts.write(Fonts.java:110)
  W/System.err(  235):    at jxl.write.biff.WritableWorkbookImpl.write(WritableWorkbookImpl.java:699)
  W/System.err(  235):    at comm.study.code.WriteExcel.write(WriteExcel.java:49)
  W/System.err(  235):    at comm.study.code.ExcelStudy.createExcelFile(ExcelStudy.java:64)
  W/System.err(  235):    at comm.study.code.ExcelStudy$1.onClick(ExcelStudy.java:47)
  W/System.err(  235):    at android.view.View.performClick(View.java:2364)
  W/System.err(  235):    at android.view.View.onTouchEvent(View.java:4179)
  W/System.err(  235):    at android.widget.TextView.onTouchEvent(TextView.java:6541)
  W/System.err(  235):    at android.view.View.dispatchTouchEvent(View.java:3709)
  W/System.err(  235):    at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
  W/System.err(  235):    at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
  W/System.err(  235):    at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
  W/System.err(  235):    at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1659)
  W/System.err(  235):    at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1107)
  W/System.err(  235):    at android.app.Activity.dispatchTouchEvent(Activity.java:2061)
  W/System.err(  235):    at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1643)
  W/System.err(  235):    at android.view.ViewRoot.handleMessage(ViewRoot.java:1691)
  W/System.err(  235):    at android.os.Handler.dispatchMessage(Handler.java:99)
  W/System.err(  235):    at android.os.Looper.loop(Looper.java:123)
  W/System.err(  235):    at android.app.ActivityThread.main(ActivityThread.java:4363)
  W/System.err(  235):    at java.lang.reflect.Method.invokeNative(Native Method)
  W/System.err(  235):    at java.lang.reflect.Method.invoke(Method.java:521)
  W/System.err(  235):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
  W/System.err(  235):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
  W/System.err(  235):    at dalvik.system.NativeStart.main(Native Method)
  </code></pre>