
Dear Help,

I am using the library RODBC to export data into an excel file with different sheets. 

Here is the code:

library(RODBC)

save2excel <- function(x, t.name,channel) {
sqlSave(channel, x, tablename = t.name, rownames = FALSE)
}

## Write Parameters to Excel 
channel <- odbcConnectExcel(paste(data.dir,"Calibrated_Parameters_Full_Set",".xls",sep=""), readOnly = FALSE)
save2excel(biological.parameters, "parameter", channel)
save2excel(mixing.parameters[[1]], "orientation_mix", channel)
save2excel(mixing.parameters[[2]], "risk_mix", channel)
save2excel(mixing.parameters[[3]], "partnership_rates", channel)
save2excel(mixing.parameters[[4]], "age_mixing_window", channel)
odbcCloseAll()

The above works fine as long as the file Calibrated_Parameters_Full_Set.xls does not exist. If it does exist then I get errors.

What command do I need to use to delete the whole Calibrated_Parameters_Full_Set.xls file or delete specific sheets - so that I can rewrite them?

Thanks.

Raff.

 		 	   		  
	[[alternative HTML version deleted]]

