Dashboard > Watir > ... > Contributions > Excel interface class
Watir Log In View a printable version of the current page.
Excel interface class
Added by David Brown, last edited by David Brown on Jul 11, 2007  (view change)
Labels: 
(None)

Excel Interface Class

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 Date Comment  
Microsoft Excel test_XLS_data.xls 26 kb David Brown Jul 11, 2007 Test data used by the unit tests adn the example  
File XLS_Test.rb 5 kb David Brown Jul 11, 2007 Unit tests for the interface class  
File Xls.rb 12 kb David Brown Jul 11, 2007 The excel interface class  
File XLS_usage_example.rb 0.7 kb David Brown Jul 11, 2007 Example data-driven Watir script  
File XLS.zip 38 kb David Brown Jul 11, 2007 Zip Archive containing all files (including RDOC documentation)  

Site running on a free Atlassian Confluence Community License granted to OpenQA. Evaluate Confluence today.
Powered by Atlassian Confluence, the Enterprise Wiki. (Version: 2.5.6 Build:#812 Aug 06, 2007) - Bug/feature request - Contact Administrators