Interface DataTableSource
데이터표소스
데이터를 DataTable
로 나타낼 수 있는 객체의 인터페이스입니다.
클래스 구현
자세한 문서
getDataTable()
이 객체 내의 데이터를 DataTable으로 반환합니다.
// Opens the spreadsheet file by its ID. If you created your script from a
// Google Sheets file, use SpreadsheetApp.getActiveSpreadsheet().
// TODO(developer): Replace the ID with your own.
const ss = SpreadsheetApp.openById('abc123456');
// Gets Sheet1 by its name.
const sheet = ss.getSheetByName('Sheet1');
// Gets the range A1:B7 on Sheet1.
const range = sheet.getRange('A1:B7');
// Gets the range A1:B7 as a data table. The values in each column must be of
// the same type.
const datatable = range.getDataTable();
// Uses the Charts service to build a bar chart from the data table.
// This doesn't build an embedded chart. To do that, use
// sheet.newChart().addRange() instead.
const chart = Charts.newBarChart()
.setDataTable(datatable)
.setOption('title', 'Your Chart Title Here')
.build();
리턴
DataTable
: 데이터를 데이터 표로 표시합니다.
달리 명시되지 않는 한 이 페이지의 콘텐츠에는 Creative Commons Attribution 4.0 라이선스에 따라 라이선스가 부여되며, 코드 샘플에는 Apache 2.0 라이선스에 따라 라이선스가 부여됩니다. 자세한 내용은 Google Developers 사이트 정책을 참조하세요. 자바는 Oracle 및/또는 Oracle 계열사의 등록 상표입니다.
최종 업데이트: 2024-12-22(UTC)
[null,null,["최종 업데이트: 2024-12-22(UTC)"],[[["`DataTableSource` is an interface for objects that can present their data as a `DataTable` for use in Google Charts."],["Classes such as `DataTable` and `Range` implement the `DataTableSource` interface."],["The primary method of `DataTableSource` is `getDataTable()`, which returns the object's data formatted as a `DataTable`."],["You can access data from spreadsheet ranges and use it to create charts using the `DataTableSource` and the Charts service."]]],["The `DataTableSource` interface allows objects to represent data as a `DataTable`. It includes the `getDataTable()` method, which returns the object's data in `DataTable` format. Classes like `DataTable` and `Range` implement this interface. The provided example demonstrates retrieving a `Range` from a spreadsheet, converting it to a `DataTable` using `getDataTable()`, and then utilizing this data to construct a bar chart with the Charts service.\n"]]