Method: WinExcel::ExcelFile#getColumnRecords
- Defined in:
- lib/winexcel/excel_file/other_methods.rb
#getColumnRecords(myRange, sheet = nil) ⇒ Object
Returns an array of hashes representing data records stored in rows in the given myRange and sheet. myRange can either be a string representing a range: “A1:C4”, a named range defined in the workbook: “SomeNamedRange”, or the text in a cell “myRangeing” a contigious table of values below it. If it is nil or not specified the CurrentRegion starting at “A1” is used. Note: myRange should include headers, and may contain non-contigious column ranges of equal size EXAMPLE DATA:
A B C
1 ID 001 002
2 Name Fredrick White Robert Green
3 NickName fred bob
Standard Range Example: getColumnRecords(“A1:C3”) would return the following array of hashes:
[ {'ID'=>'001', 'Name'=>'Fredrick White', 'Nickname'=>'fred'},
{'ID'=>'002', 'Name'=>'Robert Green', 'Nickname'=>'bob'} ]
191 192 193 |
# File 'lib/winexcel/excel_file/other_methods.rb', line 191 def getColumnRecords(myRange, sheet = nil) return convert2DArrayToArrayHash(get2DArray(myRange, sheet), false) end |