api for deleting worksheet

issue #746

also some reordering and comments in details.