read_multi_sheets#

caf.van.utilities.read_multi_sheets(path, sheets, **kwargs)[source]#

Function to read in multiple excel sheets.

Reads all sheets into a dictonary and provides detailed error messages about missing columns.

Parameters:
  • path (Path) – Path to the XLSX file.

  • sheets (Dict[Dict, list or tuple]) – Dictionary of the sheets to be read, where the keys are sheet names and the values are used for the columns parameter of read_excel.

  • kwargs (all other keyword arguments) – Passed to pandas.read_excel for every sheet.

Returns:

Dictionary where the keys are sheet names and values are the DataFrames containing the information from each sheet.

Return type:

Dict[pd.DataFrame]

Raises:

MissingWorksheetError – If any sheets given don’t exist in the XLSX.