I import a csv file into the sheet which I then clean up of any columns I do not need by using the function below. I want to extend the functionality of this script. After deleting those columns using the function below, I want to be able to run a separate function that does the following:Make all cells in the first row become a Data Filter. Ideally this row should be frozen.After the Data Filter is set, I want to make 5 duplicates of this sheet so I can use them to create different reports within the same file. I plan to manually adjust the filter values in each sheet. However kudos if the script is able to sort the Name column as A-Z in one sheet and in a different sheet sort the Salary column as Z-A. The following script adds a menu item that allows you to run the deleteColumns function. This function deletes all columns which do not have a header that matches the values for the required variable. Below is basically the 1st step of my process when preparing reports. This question is solve Step 2 in the process.  function onOpen() {   var spreadsheet = SpreadsheetApp.getActive();   var menuItems = [                   {name: 'Delete Columns', functionName: 'deleteColumns'}   ];   spreadsheet.addMenu('Prep Report', menuItems); }function deleteColumns() {  var required = [Name, Position, Salary];  var sheet = SpreadsheetApp.getActiveSheet();  var width = sheet.getLastColumn();  var headers = sheet.getRange(1, 1, 1, width).getValues()[0];  for (var i = headers.length - 1; i >= 0; i--) {    if (required.indexOf(headers[i]) == -1) {      sheet.deleteColumn(i+1);    }  }}You can learn more about the above script here.
Script that modifies the Active Sheet to set the first row as a Data Filter and then duplicate the Sheet
google spreadsheets;google apps script