Ask a Question

delete or clear excel xlsx file

SOLVED
LennSar
Contributor

delete or clear excel xlsx file

Hi there,

I use a xlsx file to basically buffer some reference data. In the first step I generate that data, write it to a xlsx file and later get that data back from the xlsx file to compare it against the response of a Rest get request. 
To make sure that I only have the data generated in the current run I delete the files in an initial step using this groovy script:

def prjPath = context.expand('${projectDir}')
new File("${prjPath}/reports.xlsx").delete()
new File("${prjPath}/reportDates.csv").delete()

I can see from a command line and the explorer that the file is deleted but once I access it at the end of the above described process again the file contains the old data and the new data is appended to the data from the previous ran.

I assume this is some funny Windows magic which is caused by Windows not really deleting the file and by generating it with the 'Append' check box activated I basically retrieve the file from the trash and append the new data to it? 

Therefore, I would like to ask you whether you know of any good way to either REALLY delete these files or clear the content of the files.

 

Thanks a lot!

 

3 REPLIES 3
LennSar
Contributor

Just realised this is the wrong forum as this is ReadyApi related. May some overpowered individual please delete this? I copied this to the ReadyApi Community

I can't delete it but if you happen to be in the wrong forum again, ask and we can move it for you. 😉


Marsha_R
[Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
LennSar
Contributor

will do 😉 thanks

cancel
Showing results for 
Search instead for 
Did you mean: