I just tried it myself on bound script against a basic sheet with data in a few columns and rows and it worked fine. It cleared only the data and left the formatting and data validation. The function was as follows :
function myFunction() {
let sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Sheet1");
let range = sheet.getRange(1,1,sheet.getLastRow(),sheet.getLastColumn());
range.clear();
}
Are you running this bound, or unbound? How are you selecting the range?