React Native Requires Chilkat v11.3.0+
React Native
XLSX Get Sheet Names
Open an Excel spreadsheet (.xlsx) and get the names of the sheets.Chilkat React Native Downloads
import { Csv, StringTable, Zip } from '@chilkat/react-native'
async function chilkatExample() {
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
// .xlsx files are Zip archives
const zip = new Zip();
try {
await zip.openZipAsync('qa_data/excel/fakeCompanies.xlsx');
} catch {
console.log(zip.lastErrorText);
return;
}
const csv = new Csv();
const sheetNames = new StringTable();
try {
csv.xlsxGetSheets(zip, sheetNames);
} catch {
console.log(csv.lastErrorText);
return;
}
let i = 0;
while (i < sheetNames.count) {
console.log(sheetNames.stringAt(i));
i++;
}
}