Package tlib :: Package base :: Module XlsHelper :: Class XlsHelper
[hide private]
[frames] | no frames]

Class XlsHelper

source code

   object --+    
            |    
Helper.Helper --+
                |
               XlsHelper

Helper class for excel data operations on excel spread sheet

Instance Methods [hide private]
 
__init__(self, path, isFirstRowHeader=True)
Constructor for class
source code
 
xls2dict(self, sheet=None, isFirstRowHeader=True)
Convert excel data to dictionary (key for sheet name), the result will be stored in data attribute
source code
 
data(self)
The excel data extracted from the file
source code
 
getSheetData(self, sheet)
Get the excel sheet data on specific sheet
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables [hide private]
  _data = {}
  _path = None

Inherited from Helper.Helper: logger

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, path, isFirstRowHeader=True)
(Constructor)

source code 

Constructor for class

Parameters:
  • path - path to the excel file
  • isFirstRowHeader - is the first row of the excel file a header row? If true, the return result for reach row will be dictionary, otherwise, it will be a list
Overrides: object.__init__

xls2dict(self, sheet=None, isFirstRowHeader=True)

source code 

Convert excel data to dictionary (key for sheet name), the result will be stored in data attribute

Parameters:
  • sheet - name of the specific sheet to fetch the data
  • isFirstRowHeader - is the first row of the excel file a header row? If true, the return result for reach row will be dictionary, otherwise, it will be a list

data(self)

source code 

The excel data extracted from the file

Decorators:
  • @property

getSheetData(self, sheet)

source code 

Get the excel sheet data on specific sheet

Parameters:
  • sheet - name of the sheet to fetch the data
Returns:
a list of data from the specified sheet or empty list if no sheet found