Is it possible to clear the csv file before running the macro again?

Hi there!
I’m trying to find and collect titles of search results on a website. Tried it first with storeText alone, but it always stopped at the first occurence of a title and I want them all. I have a while-loop now which stores the text (headline) as !csvLine and after the loop it does csvSave, which is what I want and works as expected.

But when I run the macro again, it appends the same results in the csv, which is not great. I would want kantu to overwrite the same first line everytime the macro runs (so I can easily do other stuff with the collected data). Is there a command which can delete/clear the file before running?

Best regards

Hi @msbt

Kantu can add only line in csv not delete or edit lines.

Have a nice day

Hey @newuserkantu, thanks for the reply, very unfortunate, but I’ll work around it.
Cheers

Hi @msbt

You can bypass this problem in 2 ways

  1. If you use xmodule and save tha csv in hard drive (your hard disk) you can run a batch file to delete the csv (via xtype command)

  2. If you use local storage mode (save csv inside kantu with csv manager) you can create a new csv directly with kantu with the function csvline and csvsave. Kantu when try to save info in csv if the csv is not present will be created by Kantu.

https://a9t9.com/kantu/docs/selenium-ide/csvsave

Have a nice day

1 Like

thanks again @newuserkantu, the file system storage mode did the trick!