Skip to content

Content Consulting, Web Development, Workflow Solutions, & Training for Small Businesses

Configuring Ubuntu for Drupal Spreadsheet Node Imports

-

****Update. Sheetnode 1.5 no longer requires a standalone Java Server so this post is N/A. Please see http://drupal.org/project/sheetnode for info***

The Sheetnode module for Drupal 6 is a great way to incorporate shreadsheets as node types useful for calculators, sales tools, or a variety of other uses.  Installing the Sheetnode module is fairly straitforward according the instructions on the project page at http://drupal.org/project/sheetnode.  The only requirement is downloading the SocialCalc libarary and applying the module author's included patch.  Out of the box, spreadsheets can then be created as new nodes.  Many organizations already have complicated spreadsheets in xls format that need to be imported rather than manually created.  Importing xls spreadsheets works great, but does require some specific server configuration to work properly.  Since a lot of this information is scattered in bits accross the web, I've consilidated the process for those running Ubuntu servers.

Install the Sheetnode Module in accordance with the instructions at http://drupal.org/project/sheetnode.

*Disclaimer* Please backup your server image before proceeding.  I use this setup on a development platform and then transfer imported xls sheetnodes to the production site.  The Sheetnode XLS Import module requires the standalone version of the PHP-Java Bridge servlet which is not recommended in a production environment.  Once you're ready to proceed:

Check and see if you already have a JRE installed:

sudo java -version

If it is you will see something like:

java version "1.6.0_15"
Java(TM) SE Runtime Environment (build 1.6.0_15-b03)
Java HotSpot(TM) 64-Bit Server VM (build 14.1-b02, mixed mode)

If it's not installed, we'll update our apt-get sources and install it. We need to add the multiverse repositories to our sources so that we can install third party packages such as the Sun Java 6 JDK and JRE. Using the multiverse repository, it's important to realize that third party packages may have some risks.

sudo cp /etc/apt/sources.list /etc/apt/sources.list.backup
sudo nano /etc/apt/sources.list

Add the following code to the end of the file if the multiverse repositories aren't already enabed, exit, and save: (specific to Ubuntu 9.04, consult Ubuntu.com for the proper repositories per distro)

deb http://archive.ubuntu.com/ubuntu/ karmic multiverse
deb-src http://archive.ubuntu.com/ubuntu/ karmic multiverse
deb http://archive.ubuntu.com/ubuntu/ karmic-updates multiverse
deb-src http://archive.ubuntu.com/ubuntu/ karmic-updates multiverse

Now we need to let the apt manager know we added it:

sudo apt-get update
sudo apt-get install sun-java6-jdk sun-java6-jre

Try it again:

sudo java -version

Once we have the JRE set up, we need to install the PHP-Java Bridge. Currently the Sheetnode module requires the 5.x release even though 6.x is available. The PHP-Java Bridge and the Apache POI library need to be accessible by the web server. Change to a the accessible directory you want to use and download the bridge:

sudo wget http://sourceforge.net/projects/php-java-bridge/files/RHEL_FC%20SecurityEnhancedLinux/php-java-bridge_5.5.4.1/php-java-bridge_5.5.4.1.tar.gz/download
sudo tar -xvf php-java-bridge_5.5.4.1.tar.gz

Next we need to extract the .jar file from the .war file:

sudo java -classpath JavaBridge.war TestInstallation

Add the following line to your php.ini file:

extension=java.so

Next we'll download the Apache POI needed to convert xls files. Once again make sure you're in a web accessible directory:

sudo wget http://www.apache.org/dyn/closer.cgi/poi/release/bin/poi-bin-3.6-20091214.tar.gz
sudo tar -xvf poi-bin-3.6-20091214.tar.gz

Bounce the webserver for our new additions to be included:

sudo /etc/init.d/apache2 restart

In order to use the import function we need to manually start the servlet. I do not run this servlet on a production site:

sudo java -jar JavaBridge.jar SERVLET_LOCAL:8080

Now we're ready to configure Drupal for the imports. Enter the web accessible POI path at admin/settings/sheetnode/xls and the web accessible bridge settings at admin/settings/pjb.  Next try to import a spreadsheet under node/add/xls.  Errors generally will result from improper servlet setup but can occur if .xlsx spreadsheets are imported.  Newer spreadsheets need to be saved in 2007 .xls format.  I'm currently running Ubuntu 9.04. I hope it helps, it's a great module.

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <pre>, <apt>, <bash>, <drupal6>, <java>, <javascript>, <jquery>, <php>, <python>, <ruby>, <text>. The supported tag styles are: <foo>, [foo], [[foo]].
By submitting this form, you accept the Mollom privacy policy.
sfy39587p00