Excel interface class

Excel Interface Class

Contributed by: David Brown

Summary

This ruby class provides simple methods for reading and writing data records to and from Excel spreadsheets. This data can then be easily used to create data-driven Watir tests. This class hides the complexities of directly using ruby's win32ole library to interface with Excel.

Features

  • Excel Data can be identified/located on any sheet using and either a "Range" (e.g. "A1:C20") or dynamically by searching for a specific text label above a data range
  • Excel Data formated as rows of records or as columns of records can easily be read
  • Data can be read in as an Array of Hashes (using headers as keys), a plain 2D Array, or a simple Hash of key-value pairs.
  • If the excel data file is already open, this class will simply attach to the open workbook and read its data instead of trying to re-open the file.
  • [6/22/07] Support adding and removing excel worksheets
  • [6/22/07] Support for ordered hashes, and writing them back to an excel file.
  • [6/25/07] Uploaded the RDOC documentation for the XLS class see XLS_doc.zip
  • [7/11/07] Made all get methods more flexible in how the range is specified (they now accept a string representing a literal range,a Named Range in the workbook, or a text label above a contiguous range of cells with data). This allowed me to simplify/shorten method names and to remove Redundant methods.
  • [7/11/07]Updated the RDOC. It is now included in the attached XLS.zip file.
Name Size Creator Creation Date Comment  
File XLS.zip 38 kB David Brown Jul 11, 2007 13:10 Zip Archive containing all files (including RDOC documentation)  
File XLS_usage_example.rb 0.7 kB David Brown Jul 11, 2007 13:09 Example data-driven Watir script  
File Xls.rb 12 kB David Brown Jul 11, 2007 13:09 The excel interface class  
File XLS_Test.rb 5 kB David Brown Jul 11, 2007 13:09 Unit tests for the interface class  
Microsoft Excel Sheet test_XLS_data.xls 26 kB David Brown Jul 11, 2007 13:08 Test data used by the unit tests adn the example
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
  1. Sep 29, 2008

    Alister Scott says:

    Is this still relevant with Rasta now available?

    Is this still relevant with Rasta now available?

  2. Sep 29, 2008

    sufyit says:

    I think it is still relevant. This library is not a test manager, just a tool f...

    I think it is still relevant. This library is not a test manager, just a tool for easily reading/writing data to/from excel without having to learn how to use win32ole or excel's object model.

  3. Sep 29, 2008

    Alister Scott says:

    Thanks, I have moved it under Advanced Examples.

    Thanks, I have moved it under Advanced Examples.