I want to create a custom page to let user send the file to server.
After receiving the file, openerp will create records into the database base on the value in the file
what should I do?
If you want to import function, first clear which file extension are use for data like .CSV or .XLS.
anyways, you have to create a function and read the data from .CSV or .XLS file.
from xlrd import open_workbook
def import_data(self, cr, uid, ids, context=None):
temp_path = tempfile.gettempdir()
test_obj = self.pool.get('test.test')
xls_data = base64.decodestring(xls_file)
wb = open_workbook(temp_path+'/xsl_file.xls')
for sheet in wb.sheets():
for rownum in range(sheet.nrows):
if rownum == 0:
header_list = sheet.row_values(rownum)
Hope this will help you alot
Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!
About This Community
|Asked: 1/16/15, 1:54 AM|
|Seen: 1847 times|
|Last updated: 4/30/15, 1:32 AM|