ExcelScript.TableColumn interface

テーブル内にある 1 つの列を表します。

注釈

/**
 * This script shows how to get the range of a table column.
 */
function main(workbook: ExcelScript.Workbook) {
  // Get the first table in the workbook.
  const table = workbook.getTables()[0];

  // Get the range of the table column named "Type".
  const typeColumn : ExcelScript.TableColumn = table.getColumn("Type");
  const range = typeColumn.getRange();

  // Do something with the range...
}

メソッド

delete()

テーブルから列を削除します。

getFilter()

列に適用されたフィルターを取得します。

getHeaderRowRange()

列のヘッダー行に関連付けられた範囲オブジェクトを取得します。

getId()

テーブル内の列を識別する一意のキーを返します。

getIndex()

テーブルの列コレクション内の列のインデックス番号を返します。 0 を起点とする番号になります。

getName()

テーブル列の名前を指定します。

getRange()

列全体に関連付けられた範囲オブジェクトを取得します。

getRangeBetweenHeaderAndTotal()

列のデータ本体に関連付けられた範囲オブジェクトを取得します。

getTotalRowRange()

列の集計行に関連付けられた範囲オブジェクトを取得します。

setName(name)

テーブル列の名前を指定します。

メソッドの詳細

delete()

テーブルから列を削除します。

delete(): void;

戻り値

void

/**
 * This script removes a specific column from a table.
 */
function main(workbook: ExcelScript.Workbook) {
    // Get the table named "Inventory".
    const table = workbook.getTable("Inventory");

    // If it exists, remove the column named "Category".
    let categoryColumn = table.getColumnByName("Category");
    if (categoryColumn) {
        categoryColumn.delete();
    }
}

getFilter()

列に適用されたフィルターを取得します。

getFilter(): Filter;

戻り値

/**
 * This script adds a table filter to only show the top 10% of values 
 * belonging to a particular column.
 */
function main(workbook: ExcelScript.Workbook) {
    // Get the first table on the current worksheet.
    const table = workbook.getActiveWorksheet().getTables()[0];

    // Get the filter for the "PageViews" table column.
    const pageViewFilter = table.getColumnByName("PageViews").getFilter();

    // Apply a filter to only show the rows with the top 10% of values in this column.
    pageViewFilter.applyTopPercentFilter(10);
}

getHeaderRowRange()

列のヘッダー行に関連付けられた範囲オブジェクトを取得します。

getHeaderRowRange(): Range;

戻り値

getId()

テーブル内の列を識別する一意のキーを返します。

getId(): number;

戻り値

number

getIndex()

テーブルの列コレクション内の列のインデックス番号を返します。 0 を起点とする番号になります。

getIndex(): number;

戻り値

number

getName()

テーブル列の名前を指定します。

getName(): string;

戻り値

string

getRange()

列全体に関連付けられた範囲オブジェクトを取得します。

getRange(): Range;

戻り値

getRangeBetweenHeaderAndTotal()

列のデータ本体に関連付けられた範囲オブジェクトを取得します。

getRangeBetweenHeaderAndTotal(): Range;

戻り値

/**
 * This script adds a new column to a table.
 * It then sets the formulas in the new column to be the product
 * of the values in the two preceding columns.
 */
function main(workbook: ExcelScript.Workbook) {
  // Get the first table in the workbook.
  const table = workbook.getTables()[0];

  // Append an empty column to the table with the header "Total". 
  const totalColumn = table.addColumn(-1, null, "Total");

  // Get the names of the two preceding columns.
  const productColumnName1 = table.getColumns()[totalColumn.getIndex() - 1].getName();
  const productColumnName2 = table.getColumns()[totalColumn.getIndex() - 2].getName();
  
  // Set the formulas in the "Total" column to be the product of the two preceding columns.
  totalColumn.getRangeBetweenHeaderAndTotal().setFormula(
    `=[@[${productColumnName1}]]*[@[${productColumnName2}]]`
  );
}

getTotalRowRange()

列の集計行に関連付けられた範囲オブジェクトを取得します。

getTotalRowRange(): Range;

戻り値

setName(name)

テーブル列の名前を指定します。

setName(name: string): void;

パラメーター

name

string

戻り値

void