How to create and write data to excel file without prompting a dialog

I want to export the dataset to excel by using system.dataset.exportExcel() function. when I tried, it asked me to select a path to export it. But I want it to export my data with overwriting and without asking me to select path. I cannot see a paramater about that inside the function. How can I do that ?

Use system.dataset.toExcel() instead, then system.file.writeFile(). See the example for toExcel().