Hi All,
Recently I have a requirement as below: I want the users upload the excel file and when they execute the data loading process, they trigger the BefImport event script and the script should convert the excel file to txt and import the txt file instead of the excel file.
What I have now is I am now able to use python to open an excel file on local -> read all the content -> copy all the data to a flat file and save it on local.Unfortunately my code below does not work this way.
However, I stuck at the file uploading and file reading parts on FDMEE.
1.How can I save the txt file to FDMEE server as the FDMEE only can import data that on its own server?
2.If the txt file is saved to FDMEE server successfully, how can I let the Data load rule use this txt to replace the xls file?
/servlet/JiveServlet/downloadImage/2-14094200-251776/xlsx.jpg
------Code starts here--------
import xlrd
workbook=xlrd.open_workbook("fdmContext["INBOXDIR"]"+"/ExcelFormatConvertTest.xlsx")
sh=workbook.sheet_by_name("Sheet1")
print sh.nrows
print sh.ncols
r=0
c=0
file=open("fdmContext["INBOXDIR"]"+"/ExcelFormatConverTest.txt","w")
for r in range(sh.nrows):
for c in range(sh.ncols):
data =sh.cell\_value(r,c)+" "
print data,
file.write(data+" ")
print
file.write("\\n")
file.close()
------Code Ends here--------
Error log:

Any idea or suggestion will be appreciate!
Thanks