code: def xlsx_table(
      path: Union[str, Workbook],
      sheetname: str,
      table: Union[str, list, tuple] = None,
  ) -> Union[pd.DataFrame, dict]:
      """Returns a DataFrame of values in a table in the Excel file.
  
      This applies to an Excel file, where the data range is explicitly
      specified as a Microsoft Excel table.
  
      If there is a single table in the sheet, or a string is provided
      as an argument to the `table` parameter, a pandas DataFrame is returned;
      if there is more than one table in the sheet,
      and the `table` argument is `None`, or a list/tuple of names,
      a dictionary of DataFrames is returned, where the keys of the dictionary
      are the table names.
  
      Examples:
          >>> import pandas as pd
          >>> from janitor import xlsx_table
          >>> filename="../pyjanitor/tests/test_data/016-MSPTDA-Excel.xlsx"
  
          Single table:
  
          >>> xlsx_table(filename, sheetname='Tables', table='dCategory')
             CategoryID       Category
          0           1       Beginner
          1           2       Advanced
          2           3      Freestyle
          3           4    Competition
          4           5  Long Distance
  
          Multiple tables:
  
          >>> out=xlsx_table(filename, sheetname="Tables", table=["dCategory", "dSalesReps"])
          >>> out["dCategory"]
             CategoryID       Category
          0           1       Beginner
          1           2       Advanced
          2           3      Freestyle
          3           4    Competition
          4           5  Long Distance
          >>> out["dSalesReps"].head(3)
             SalesRepID             SalesRep Region
          0           1  Sioux Radcoolinator     NW
          1           2        Tyrone Smithe     NE
          2           3         Chantel Zoya     SW
  
      Args:
            path: Path to the Excel File. It can also be an openpyxl Workbook.
            sheetname: Name of the sheet from which the tables
                  are to be extracted.
            table: Name of a table, or list of tables in the sheet.
  
      Raises:
          AttributeError: If a workbook is provided, and is a ReadOnlyWorksheet.
          ValueError: If there are no tables in the sheet.
          KeyError: If the provided table does not exist in the sheet.
  
      Returns:
          A pandas DataFrame, or a dictionary of DataFrames,
              if there are multiple arguments for the `table` parameter,
              or the argument to `table` is `None`.
      """  # noqa : E501
  
      try:
          from openpyxl import load_workbook
          from openpyxl.workbook.workbook import Workbook
      except ImportError:
          import_message(
              submodule="io",
              package="openpyxl",
              conda_channel="conda-forge",
              pip_install=True,
          )
      if isinstance(path, Workbook):
          ws = path[sheetname]
      else:
          ws = load_workbook(
              filename=path,
              read_only=False,
              keep_links=False,
              data_only=True,
          )
          ws = ws[sheetname]
  
      try:
          contents = ws.tables
      except AttributeError as error:
          raise AttributeError(
              "Accessing the tables is not supported for ReadOnlyWorksheet"
          ) from error
  
      if not contents:
          raise ValueError(f"There is no table in '{sheetname}' sheet.")
  
      class TableArgs(NamedTuple):
          """
          Named Tuple to easily index values
          from the tables in the sheet.
          """
  
          table_name: str
          ref: str
          headerRowCount: int
  
      if isinstance(table, str):
          table = [table]
      if table is not None:
          check("table", table, [str, list, tuple])
          try:
              data = []
              for key in table:
                  outcome = TableArgs(
                      key,
                      contents[key].ref,
                      contents[key].headerRowCount,
                  )
                  data.append(outcome)
          except KeyError as error:
              raise KeyError(
                  f"Table {error} is not in the '{sheetname}' sheet."
              ) from error
      else:
          data = (
              TableArgs(
                  key, contents[key].ref, contents[key].headerRowCount
              )
              for key in contents
          )
  
      frame = {}
      for table_arg in data:
          content = [
              [cell.value for cell in row] for row in ws[table_arg.ref]
          ]
  
          if table_arg.headerRowCount:
              header, *content = content
          else:
              header = [f"C{num}" for num in range(len(content[0]))]
          frame[table_arg.table_name] = pd.DataFrame(
              content, columns=header, copy=False
          )
  
      if len(frame) == 1:
          _, frame = frame.popitem()
      return frame
  
file_path: pyjanitor/janitor/io.py
imports: from __future__ import annotations
  import inspect
  import os
  import subprocess
  from collections import defaultdict
  from glob import glob
  from io import StringIO
  from itertools import chain
  from typing import TYPE_CHECKING, Any, Iterable, NamedTuple, Union
  import pandas
  from .errors import JanitorError
  from .utils import check, deprecated_alias, import_message
label_desc: Use image node_id 3 for calling a global function with example usage: xlsx_table(path, sheetname, table) and returns: frame