ExcelScript.ClearApplyTo enum

Remarks

Examples

/**
 * This script removes any extra formatting that's been applied to a table. 
 * This leaves only the base table style effects.
 * Any formatting outside of the table will be left as is.
 */
function main(workbook: ExcelScript.Workbook) {
  // Get the first table on the current worksheet.
  let worksheet = workbook.getActiveWorksheet();
  let table = worksheet.getTables()[0];

  // Get the range used by the table.
  let range = table.getRange();

  // Clear all the formatting that is not applied by the table and the table style.
  range.clear(ExcelScript.ClearApplyTo.formats);
}

Fields

all

Clears everything in the range.

contents

Clears the contents of the range, leaving formatting intact.

formats

Clears all formatting for the range, leaving values intact.

hyperlinks

Clears all hyperlinks, but leaves all content and formatting intact.

removeHyperlinks

Removes hyperlinks and formatting for the cell but leaves content, conditional formats, and data validation intact.