# Save .xls file to specific path

**URL:** <https://forum.inductiveautomation.com/t/save-xls-file-to-specific-path/17228>\
**Category:** Ignition\
**Created:** [March 5, 2018, 5:20pm UTC](https://forum.inductiveautomation.com/t/save-xls-file-to-specific-path/17228 "2018-03-05T17:20:11Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![kishna009](https://avatars.discourse-cdn.com/v4/letter/k/c67d28/32.png) [@kishna009](https://forum.inductiveautomation.com/u/kishna009)\
**Post date:** [March 5, 2018, 5:20pm UTC](https://forum.inductiveautomation.com/t/save-xls-file-to-specific-path/17228/1 "2018-03-05T17:20:11Z")

</div>

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)

---

<div class="post-metadata">

**Author:** ![kishna009](https://avatars.discourse-cdn.com/v4/letter/k/c67d28/32.png) [@kishna009](https://forum.inductiveautomation.com/u/kishna009)\
**Post date:** [March 5, 2018, 5:53pm UTC](https://forum.inductiveautomation.com/t/save-xls-file-to-specific-path/17228/2 "2018-03-05T17:53:22Z")

</div>

Hi all,  
i want to save without user interference

Thanks

---

<div class="post-metadata">

**Author:** ![bfuson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bfuson/32/4597_2.png) [@bfuson](https://forum.inductiveautomation.com/u/bfuson)\
**Post date:** [March 5, 2018, 5:57pm UTC](https://forum.inductiveautomation.com/t/save-xls-file-to-specific-path/17228/3 "2018-03-05T17:57:46Z")

</div>

Use the FileWriter from the Java standard library:

```auto
from java.io import File, FileWriter

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

```

---

<div class="post-metadata">

**Author:** ![kishna009](https://avatars.discourse-cdn.com/v4/letter/k/c67d28/32.png) [@kishna009](https://forum.inductiveautomation.com/u/kishna009)\
**Post date:** [March 5, 2018, 6:52pm UTC](https://forum.inductiveautomation.com/t/save-xls-file-to-specific-path/17228/4 "2018-03-05T18:52:49Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![phillip.bow](https://avatars.discourse-cdn.com/v4/letter/p/ce73a5/32.png) [@phillip.bow](https://forum.inductiveautomation.com/u/phillip.bow)\
**Post date:** [March 5, 2018, 7:10pm UTC](https://forum.inductiveautomation.com/t/save-xls-file-to-specific-path/17228/5 "2018-03-05T19:10:53Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![kishna009](https://avatars.discourse-cdn.com/v4/letter/k/c67d28/32.png) [@kishna009](https://forum.inductiveautomation.com/u/kishna009)\
**Post date:** [March 5, 2018, 7:26pm UTC](https://forum.inductiveautomation.com/t/save-xls-file-to-specific-path/17228/6 "2018-03-05T19:26:48Z")

</div>

Hi Philip,  
from [java.io](http://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.

---

<div class="post-metadata">

**Author:** ![phillip.bow](https://avatars.discourse-cdn.com/v4/letter/p/ce73a5/32.png) [@phillip.bow](https://forum.inductiveautomation.com/u/phillip.bow)\
**Post date:** [March 5, 2018, 7:39pm UTC](https://forum.inductiveautomation.com/t/save-xls-file-to-specific-path/17228/7 "2018-03-05T19:39:38Z")

</div>

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