Save .xls file to specific path

Hi All,
can you please help in suggesting syntax for saving .xls file to specific location in my system
data=event.source.parent.getComponent(‘WMpwmName’).text
filename = system.file.saveFile(“padid2excel.xls”)
filePath = “E:\padid2excel.xls”
if filename !=None:
system.file.writeFile(filename, data)

Hi all,
i want to save without user interference

Thanks

Use the FileWriter from the Java standard library:

from java.io import File, FileWriter

file = File(path)
fw = FileWriter(file, False)
fw.write(data) 
fw.close()

Thanks lot bfuson!!
is that possible to append data in same file ?? instead of opening new file ??

I am attempted to use new Filewriter(file,true) but it is throwing error.

The error would be helpful, but if you are saving an XLS file then you cannot just append to the file. A structured document like most Office files requires that everything be saved in a particular way so appending would essentially make the file unreadable to Excel.

Hi Philip,
from java.io import File, FileWriter

file = File(path)
fw = FileWriter(file, true)>>>true is not defined" in line #3
fw.write(data)
fw.close()

file = File(path)
fw = new FileWriter(file, true)>>>true is not defined" in line #3
fw.write(data)
fw.close()

Error was: “true is not defined” in line #3
I tried saving file as CSV instead of xls format, so that it will not throw prompt when opened.
Please let me know if i can do it another way.

Just a case-sensitivity issue in that case, try:
FileWriter(file, True)