Function readExcelFile

  • Reads an Excel file and returns its content as a record where each key is the name of a worksheet and its value is a 2D array of strings representing the rows and cells of the worksheet.

    Parameters

    • filepath: string

      The path to the Excel file to read.

    Returns Promise<Record<string, string[][]>>

    A Promise that resolves to a record where each key is the name of a worksheet and its value is a 2D array of strings representing the rows and cells of the worksheet.

    Remarks

    This function uses the exceljs library to read the Excel file. It will throw an error if the file does not exist or is not a valid Excel file.

    Throws

    Will throw an error if the file does not exist or is not a valid Excel file.

    Example

    readExcelFile('path/to/file.xlsx').then((worksheets) => {
    console.log(worksheets['Sheet1']); // logs the content of 'Sheet1'
    });

Generated using TypeDoc