def document_to_workbook(doc, wb=None, base_url=None):
    """
    Takes a string representation of an html document and writes one sheet for
    every table in the document.
    The workbook is returned
    """
    if not wb:
        wb = Workbook()
        wb.remove(wb.active)

    inline_styles_doc = Premailer(doc, base_url=base_url, remove_classes=False).transform()
    tables = get_Tables(inline_styles_doc)

    for table in tables:
        table_to_sheet(table, wb)

    return wb

    Takes a string representation of an html document and writes one sheet for
    every table in the document.
    The workbook is returned
    
ptstructure/table/tablepyxl/tablepyxl.py