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

Class XlsModerator

source code

object --+
         |
        XlsModerator

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
 
get_sheet_data(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
Properties [hide private]
  data
The excel data extracted from the file

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

get_sheet_data(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

Property Details [hide private]

data

The excel data extracted from the file

Get Method:
unreachable.data(self) - The excel data extracted from the file