Excel Export/Import, CSV Export/Import
// Excel Export
grid.exportToExcel({
filename: 'my-data', // 파일명 (확장자 제외)
includeHeader: true, // 헤더 포함
selectedOnly: false, // 선택된 행만
filteredOnly: false, // 필터된 행만
columns: ['name', 'age'], // 특정 컬럼만 (선택사항)
sheetName: 'Sheet1' // 시트 이름
});
// CSV Export (문자열 반환)
const csvString = grid.exportToCSV({ ... });
// CSV 파일 다운로드
grid.downloadCSV({ filename: 'my-data' });
// JSON Export (문자열 반환)
const jsonString = grid.exportToJSON({ ... });
// JSON 파일 다운로드
grid.downloadJSON({ filename: 'my-data' });
// CSV Import (문자열에서)
const result = grid.importFromCSV(csvString, true); // hasHeader
console.log(result.data); // 가져온 데이터
console.log(result.headers); // 헤더 목록
console.log(result.errors); // 오류 목록
// Excel Import (파일에서) - 비동기
const result = await grid.importFromExcel(file, 0); // sheetIndex
if (result.errors.length === 0) {
console.log('Successfully imported', result.data.length, 'rows');
}
// SheetJS 라이브러리 필요 여부 확인
if (VeloxGrid.isExcelSupported()) {
console.log('Excel export/import is available');
}