Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.

Why Scriptom? 

There must be a dozen different libraries out there that support reading and writing Excel documents.  Some, like POI or OpenXLS, let you manipulate Excel files directly from Java.  These libraries don't use Microsoft Excel, so they work well in mixed OS environments.  However, they don't support some key features of Excel (there are significant limitations), and their APIs don't correspond to Excel's COM API, so it can be difficult at times to figure out how use them to do even simple things. 

Other libraries, like COM4J, JCOM, and JACOB let you use Excel automation to read and create Excel files, either directly or through wrapper classes generated from COM type libraries.  This gives you full access to the complete featureset of Excel.  It also limits you to Windows.  It can be sometimes be difficult to translate from Microsoft's Visual Basic-oriented documentation to the corresponding library/wrapper in Java.  This can be particularly challenging if you aren't already up to speed on COM and the Excel API - which is probably true for most Java programmersExcel automation is also a lot slower than directly manipulating a direct file manipulation (process startup overhead, process-to-process communication). 

Scriptom is a COM automation library for Groovy, so it falls squarely into the second group.  In fact, Scriptom is an extension of JACOBJACOB does the heavy lifting, and Scriptom makes it grooviergroovy.

So why would you use Scriptom over one of the alternatives? 

Scriptom is intended to replicate the feel of COM scripting - as much as possible - within Java (Groovy)but with Groovy instead of VBScript.  It looks like COM scripting, and it feels like COM scripting.  So when you are, for instance, translating a VBA macro to its equivalent Groovy, there is very little translation involved.  You can't quite do a copy-paste, but it's close.  And when you are programming against the Microsoft documentation for the Excel API, you don't have to ask a lot of questions.  The code simply works the way it's documented. 


Scriptom is suitable for use in low-to-medium volume tasks where Excel is available.  It For example, it is useful in batch jobs, where you aren't too concerned about execution time.  And it can be used to produce reports in Excel format for a web site (throw in a pie chart in a few lines of code), as long as you don't try to deliver more than one report every couple of seconds. 

If you feel the need for speed and can get by without the full functionality provided by the Excel API, consider POI.  If you want easy to write, easy to maintain, and full-featured, your best bet is Scriptom.

Let's Get Started!

Enough with the introductions.  Let's get started with an example that shows just how easy it is to work with Excel using Scriptom. \\\\\\- various ways to read and write Excel documents