"const startTime = new Date(); // Start time for execution time logging

// Calculate and log execution time
  const endTime = new Date();
  const executionTime = (endTime - startTime) / 1000; // Time in seconds
  outputSheet.getRange('N1').setValue(`Execution time: ${executionTime} seconds`);"

is code snippet ko 

"function consolidateTrades() {

  const startTime = new Date(); // Start time for execution time logging

  let outputSheet; // Declare outputSheet outside of the try block
  try {
    const spreadsheet = SpreadsheetApp.getActiveSpreadsheet();
    const sheet = spreadsheet.getSheetByName('Trade Log_Raw');
    if (!sheet) {
      SpreadsheetApp.getUi().alert('Sheet "Trade Log_Raw" not found');
      return;
    }
    
    // Get headers from the first row (columns A to K)
    const headersRange = sheet.getRange(1, 1, 1, 11); // Columns A (1) to K (11)
    const headers = headersRange.getValues()[0];

    // Get data starting from row 3 (columns A to K)
    const dataRange = sheet.getRange(3, 1, sheet.getLastRow() - 2, 11); // Columns A (1) to K (11)
    const data = dataRange.getValues();
    if (data.length === 0) {
      SpreadsheetApp.getUi().alert('No data found to consolidate.');
      return;
    }
    
    const consolidatedData = [];
    
    // Create a map to store consolidated results
    const tradeMap = new Map();
    
    // Iterate over each row of data
    data.forEach(row => {
      // Create a unique key based on selected columns (excluding fees)
      const key = [row[0], row[1], row[2], row[3], row[5], row[8], row[9], row[10]].join('|');
      
      if (!tradeMap.has(key)) {
        // Initialize a new trade entry with fees set to 0
        tradeMap.set(key, {
          type: row[0],
          date: row[1],
          security: row[2],
          action: row[3],
          quantity: 0,
          price: row[5],
          fees: 0, // Initialize fees to 0 for aggregation
          total: 0,
          assetClass: row[8],
          broker: row[9],
          user: row[10]
        });
      }
      
      const trade = tradeMap.get(key);
      trade.quantity += row[4]; // Aggregate Quantity
      trade.fees += parseFloat(row[6]) || 0; // Aggregate Fees (ensure numerical)
      trade.total += parseFloat(row[7]) || 0; // Aggregate Total
    });
    
    // Convert map to array for output
    tradeMap.forEach(trade => {
      consolidatedData.push([
        trade.type, 
        trade.date, 
        trade.security, 
        trade.action, 
        trade.quantity,
        trade.price, 
        trade.fees, // Aggregated Fees
        trade.total, 
        trade.assetClass, 
        trade.broker, 
        trade.user
      ]);
    });
    
    // Output to the output sheet, without touching row 1
    outputSheet = spreadsheet.getSheetByName('Trade Log');
    if (!outputSheet) {
      outputSheet = spreadsheet.insertSheet('Trade Log');
      // If it's a new sheet, write headers to row 1
      outputSheet.getRange(1, 1, 1, 11).setValues([headers]);
    } else {
      // Clear contents from row 3 onwards (do not clear formatting), limit to columns A to K
      const lastRow = outputSheet.getLastRow();
      if (lastRow > 2) {
        outputSheet.getRange(3, 1, lastRow - 2, 11).clearContent(); // Columns A (1) to K (11)
      }
    }

    // Set the consolidated data starting from row 3
    if (consolidatedData.length > 0) {
      outputSheet.getRange(3, 1, consolidatedData.length, 11).setValues(consolidatedData); // Columns A (1) to K (11)
    }

    // Do not touch formatting, as per your request

  } catch (e) {
    SpreadsheetApp.getUi().alert('An error occurred: ' + e.message);
  }

  // Record the last update date and time in cell B1
  if (outputSheet) { // Check if outputSheet is defined
    let now = new Date();
    let formattedNow = Utilities.formatDate(now, "Asia/Kolkata", "dd-MMM-yyyy HH:mm:ss");
    outputSheet.getRange('B1').setValue(formattedNow); // Write to cell B1
  }

  // Calculate and log execution time
  const endTime = new Date();
  const executionTime = (endTime - startTime) / 1000; // Time in seconds
  outputSheet.getRange('N1').setValue(`Execution time: ${executionTime} seconds`);

}"

is code me sahi se impliment kr do

"Trade Log" sheet h usme isse script output krtu h