Hi folks,
I have a requirement where i need to do some manipulation of data fetched from an excel file.
I am trying to use Jython technology in ODI procedure to read the file.
After some online help i came to know about 'xlrd' module which can be imported and used in pyhton.
I am new to jython scripting where i have been reading/writing flat files.
When i try to import this module (xlrd) i get the error : "ImportError: No module named xlrd"
Below is a sample code which i would try to implement :
Need help on how i can import this module in ODI.
Any other approach to make this work in ODI-Jython is welcomed.
I am using ODI v 12.1.3
import xrd
#----------------------------------------------------------------------
def open_file(path):
"""
Open and read an Excel file
"""
book = xlrd.open_workbook(path)
# print number of sheets
print book.nsheets
# print sheet names
print book.sheet_names()
# get the first worksheet
first_sheet = book.sheet_by_index(0)
# read a row
print first_sheet.row_values(0)
# read a cell
cell = first_sheet.cell(0,0)
print cell
print cell.value
# read a row slice
print first_sheet.row_slice(rowx=0,
start_colx=0,
end_colx=2)
#----------------------------------------------------------------------
if __name__ == "__main__":
path = "test.xls"
open_file(path)
Regards,
Prashant