{"id":1550,"date":"2024-10-25T05:42:10","date_gmt":"2024-10-25T05:42:10","guid":{"rendered":"https:\/\/craftcookcode.com\/?p=1550"},"modified":"2024-10-25T05:42:10","modified_gmt":"2024-10-25T05:42:10","slug":"python-openpyxl-if-the-fraud-team-tells-you-to-do-something-do-it-quickly","status":"publish","type":"post","link":"https:\/\/craftcookcode.com\/?p=1550","title":{"rendered":"Python &amp; openpyxl &#8211;  If the fraud team tells you to do something; do it quickly!"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">A member of our Fraud team contacted me unexpectedly at work.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">Hey.  I got this excel workbook of a customer&#8217;s statement with the data spread across multiple sheets.  Do you know how to consolidate them into one sheet?<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&#8220;OK,&#8221; I thought, &#8220;It can&#8217;t be that hard.&#8221;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">She sent me the workbook.  It had <em>447<\/em> sheets in it!  The statement was initially in a PDF format and the Fraud team exported it to Excel.  This resulted in a sheet for each page; looking like this:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img fetchpriority=\"high\" decoding=\"async\" width=\"1024\" height=\"730\" src=\"https:\/\/craftcookcode.com\/wp-content\/uploads\/2024\/10\/code_fraud-1024x730.png\" alt=\"\" class=\"wp-image-1553\" srcset=\"https:\/\/craftcookcode.com\/wp-content\/uploads\/2024\/10\/code_fraud-1024x730.png 1024w, https:\/\/craftcookcode.com\/wp-content\/uploads\/2024\/10\/code_fraud-300x214.png 300w, https:\/\/craftcookcode.com\/wp-content\/uploads\/2024\/10\/code_fraud-768x547.png 768w, https:\/\/craftcookcode.com\/wp-content\/uploads\/2024\/10\/code_fraud-1536x1095.png 1536w, https:\/\/craftcookcode.com\/wp-content\/uploads\/2024\/10\/code_fraud.png 1584w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n<\/blockquote>\n\n\n\n<p class=\"wp-block-paragraph\">The data that we were interested in was between A7 and E29 on each page.  I visually spot checked half a dozen sheets across the workbook and they were in similar format<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Ditching VBA for openpyxl<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">In yesteryear; I would have VBA inside Excel to consolidate the sheets.  But I felt it was time to grow up from VBA and see what python had to offer.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">After a quick Google; I came across <a href=\"https:\/\/www.datacamp.com\/tutorial\/python-excel-tutorial\" target=\"_blank\" rel=\"noopener\" title=\"\">Data Camp&#8217;s Python Excel Tutorial<\/a>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">It was surprisingly quick and easy to program up.  I honestly thought it would have taken me as long; if not longer in VBA.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Here is the scratch code for your perusal <\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\nimport openpyxl \nimport logging\nfrom datetime import datetime\nimport csv\n\n# Formats a row into a format for the delimited file\ndef format_row(in_record):\n\n    try:\n        in_record&#x5B;0] = datetime.strftime(in_record&#x5B;0], &quot;%Y-%m-%d&quot;)  # Converts the python date to YYYY-MM-DD\n    except TypeError as e:\n        root_logger.warning(&quot;Cannot convert &quot; + in_record&#x5B;0] + &quot; to date\/time&quot;)\n\n    in_record&#x5B;1] = in_record&#x5B;1].replace(&quot;\\n&quot;, &quot; \\u21B5&quot;)    # Adds in a return arrow\n\n    if in_record&#x5B;2] == None:\n        in_record&#x5B;2] = &quot;&quot;\n\n    if in_record&#x5B;3] == None:\n        in_record&#x5B;3] = &quot;&quot;\n    \n    return in_record\n\n\nif __name__ == &#039;__main__&#039;:\n\n    now = datetime.now()\n\n    log_formatter = logging.Formatter(&quot;%(asctime)s &#x5B;%(threadName)-12.12s] &#x5B;%(levelname)-8.8s]  %(message)s&quot;)\n    root_logger = logging.getLogger()\n    root_logger.setLevel(logging.INFO)\n\n    log_console_handler = logging.StreamHandler()\n    log_console_handler.setFormatter(log_formatter)\n    root_logger.addHandler(log_console_handler)\n\n    final_array = &#x5B;]\n\n    wb = openpyxl.load_workbook(&quot;CONSOLIDATEDExcel.xlsx&quot;) \n\n    for focus_sheet_name in wb.sheetnames:\n\n        root_logger.info(&quot;Processing sheet: &quot; + focus_sheet_name)\n        \n        focus_sheet = wb&#x5B;focus_sheet_name]\n        root_logger.debug(&quot;Total number of rows: &quot; + str(focus_sheet.max_row) + &#039;. And total number of columns: &#039; + str(focus_sheet.max_column))\n\n\n        if focus_sheet&#x5B;&quot;A6&quot;].value == &quot;Date&quot;:   # Checks for the key field &quot;Date&quot; in position A6\n\n            my_list = &#x5B;]\n\n            for sheet_row in focus_sheet.iter_rows(\n                min_row=7, max_row=26, min_col=1, max_col=5,    # Gets specific section of the worksheet\n                values_only=True):\n\n                sheet_row_list = list(sheet_row)\n\n                if sheet_row_list&#x5B;0] != None:   # Ignore lines that are blank\n                    final_array.append(format_row(sheet_row_list))\n        else:\n            root_logger.info(&quot;Cannot find key column \\&quot;DATE\\&quot;.  Skipping sheet&quot;)\n\n\n    # Output records to a tab delimited file\n    with open(&quot;Consolidated_output.tab&quot;, &#039;w&#039;, newline=&#039;&#039;, encoding=&quot;utf-8&quot;) as myfile:\n        wr = csv.writer(myfile, quoting=csv.QUOTE_ALL, delimiter=&quot;\\t&quot;)\n        wr.writerows(final_array)\n        \n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">Also; it ran blindingly quick &#8211; as quick as I feel in VBA with Application.ScreenUpdating = False<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Anyway; Fraud team was happy I turned their request around quickly.  I&#8217;m guessing if the fraud team is involved &#8211; someone is about to have a bad day.  <\/p>\n","protected":false},"excerpt":{"rendered":"<p>A member of our Fraud team contacted me unexpectedly at work. The data that we were interested in was between A7 and E29 on each page.&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":1554,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[18,52],"tags":[71,69,70],"class_list":["post-1550","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-python","category-vba-vbs","tag-openpyxl","tag-python","tag-vba"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 4.9.10 - aioseo.com -->\n\t<meta name=\"description\" content=\"A member of our Fraud team contacted me unexpectedly at work. Hey. I got this excel workbook of a customer&#039;s statement with the data spread across multiple sheets. Do you know how to consolidate them into one sheet? &quot;OK,&quot; I thought, &quot;It can&#039;t be that hard.&quot; She sent me the workbook. It had 447 sheets\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"jonny.donker@gmail.com\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/craftcookcode.com\/?p=1550\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 4.9.10\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"Craft Cook Code - c^3?\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"Python &amp; openpyxl \u2013 If the fraud team tells you to do something; do it quickly! - Craft Cook Code\" \/>\n\t\t<meta property=\"og:description\" content=\"A member of our Fraud team contacted me unexpectedly at work. Hey. I got this excel workbook of a customer&#039;s statement with the data spread across multiple sheets. Do you know how to consolidate them into one sheet? &quot;OK,&quot; I thought, &quot;It can&#039;t be that hard.&quot; She sent me the workbook. It had 447 sheets\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/craftcookcode.com\/?p=1550\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2024-10-25T05:42:10+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2024-10-25T05:42:10+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Python &amp; openpyxl \u2013 If the fraud team tells you to do something; do it quickly! - Craft Cook Code\" \/>\n\t\t<meta name=\"twitter:description\" content=\"A member of our Fraud team contacted me unexpectedly at work. Hey. I got this excel workbook of a customer&#039;s statement with the data spread across multiple sheets. Do you know how to consolidate them into one sheet? &quot;OK,&quot; I thought, &quot;It can&#039;t be that hard.&quot; She sent me the workbook. It had 447 sheets\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"BlogPosting\",\"@id\":\"https:\\\/\\\/craftcookcode.com\\\/?p=1550#blogposting\",\"name\":\"Python & openpyxl \\u2013 If the fraud team tells you to do something; do it quickly! - Craft Cook Code\",\"headline\":\"Python &amp; openpyxl &#8211;  If the fraud team tells you to do something; do it quickly!\",\"author\":{\"@id\":\"https:\\\/\\\/craftcookcode.com\\\/?author=1#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/craftcookcode.com\\\/#person\"},\"image\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/craftcookcode.com\\\/wp-content\\\/uploads\\\/2024\\\/10\\\/code_fraud_0.png\",\"width\":498,\"height\":281},\"datePublished\":\"2024-10-25T05:42:10+00:00\",\"dateModified\":\"2024-10-25T05:42:10+00:00\",\"inLanguage\":\"en-US\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/craftcookcode.com\\\/?p=1550#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/craftcookcode.com\\\/?p=1550#webpage\"},\"articleSection\":\"Python, VBA \\\/ VBS, openpyxl, python, vba\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/craftcookcode.com\\\/?p=1550#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/craftcookcode.com#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/craftcookcode.com\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/craftcookcode.com\\\/?cat=13#listItem\",\"name\":\"Code\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/craftcookcode.com\\\/?cat=13#listItem\",\"position\":2,\"name\":\"Code\",\"item\":\"https:\\\/\\\/craftcookcode.com\\\/?cat=13\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/craftcookcode.com\\\/?cat=18#listItem\",\"name\":\"Python\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/craftcookcode.com#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/craftcookcode.com\\\/?cat=18#listItem\",\"position\":3,\"name\":\"Python\",\"item\":\"https:\\\/\\\/craftcookcode.com\\\/?cat=18\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/craftcookcode.com\\\/?p=1550#listItem\",\"name\":\"Python &amp; openpyxl &#8211;  If the fraud team tells you to do something; do it quickly!\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/craftcookcode.com\\\/?cat=13#listItem\",\"name\":\"Code\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/craftcookcode.com\\\/?p=1550#listItem\",\"position\":4,\"name\":\"Python &amp; openpyxl &#8211;  If the fraud team tells you to do something; do it quickly!\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/craftcookcode.com\\\/?cat=18#listItem\",\"name\":\"Python\"}}]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/craftcookcode.com\\\/#person\",\"name\":\"jonny.donker@gmail.com\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/craftcookcode.com\\\/?p=1550#personImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/12ea7810156e378894993fa29611c905482263dd05898a50ae5ece294bb6aff0?s=96&d=mm&r=g\",\"width\":96,\"height\":96,\"caption\":\"jonny.donker@gmail.com\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/craftcookcode.com\\\/?author=1#author\",\"url\":\"https:\\\/\\\/craftcookcode.com\\\/?author=1\",\"name\":\"jonny.donker@gmail.com\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/craftcookcode.com\\\/?p=1550#authorImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/12ea7810156e378894993fa29611c905482263dd05898a50ae5ece294bb6aff0?s=96&d=mm&r=g\",\"width\":96,\"height\":96,\"caption\":\"jonny.donker@gmail.com\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/craftcookcode.com\\\/?p=1550#webpage\",\"url\":\"https:\\\/\\\/craftcookcode.com\\\/?p=1550\",\"name\":\"Python & openpyxl \\u2013 If the fraud team tells you to do something; do it quickly! - Craft Cook Code\",\"description\":\"A member of our Fraud team contacted me unexpectedly at work. Hey. I got this excel workbook of a customer's statement with the data spread across multiple sheets. Do you know how to consolidate them into one sheet? \\\"OK,\\\" I thought, \\\"It can't be that hard.\\\" She sent me the workbook. It had 447 sheets\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/craftcookcode.com\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/craftcookcode.com\\\/?p=1550#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/craftcookcode.com\\\/?author=1#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/craftcookcode.com\\\/?author=1#author\"},\"image\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/craftcookcode.com\\\/wp-content\\\/uploads\\\/2024\\\/10\\\/code_fraud_0.png\",\"@id\":\"https:\\\/\\\/craftcookcode.com\\\/?p=1550\\\/#mainImage\",\"width\":498,\"height\":281},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/craftcookcode.com\\\/?p=1550#mainImage\"},\"datePublished\":\"2024-10-25T05:42:10+00:00\",\"dateModified\":\"2024-10-25T05:42:10+00:00\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/craftcookcode.com\\\/#website\",\"url\":\"https:\\\/\\\/craftcookcode.com\\\/\",\"name\":\"Craft Cook Code\",\"description\":\"c^3?\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/craftcookcode.com\\\/#person\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"Python & openpyxl \u2013 If the fraud team tells you to do something; do it quickly! - Craft Cook Code","description":"A member of our Fraud team contacted me unexpectedly at work. Hey. I got this excel workbook of a customer's statement with the data spread across multiple sheets. Do you know how to consolidate them into one sheet? \"OK,\" I thought, \"It can't be that hard.\" She sent me the workbook. It had 447 sheets","canonical_url":"https:\/\/craftcookcode.com\/?p=1550","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"BlogPosting","@id":"https:\/\/craftcookcode.com\/?p=1550#blogposting","name":"Python & openpyxl \u2013 If the fraud team tells you to do something; do it quickly! - Craft Cook Code","headline":"Python &amp; openpyxl &#8211;  If the fraud team tells you to do something; do it quickly!","author":{"@id":"https:\/\/craftcookcode.com\/?author=1#author"},"publisher":{"@id":"https:\/\/craftcookcode.com\/#person"},"image":{"@type":"ImageObject","url":"https:\/\/craftcookcode.com\/wp-content\/uploads\/2024\/10\/code_fraud_0.png","width":498,"height":281},"datePublished":"2024-10-25T05:42:10+00:00","dateModified":"2024-10-25T05:42:10+00:00","inLanguage":"en-US","mainEntityOfPage":{"@id":"https:\/\/craftcookcode.com\/?p=1550#webpage"},"isPartOf":{"@id":"https:\/\/craftcookcode.com\/?p=1550#webpage"},"articleSection":"Python, VBA \/ VBS, openpyxl, python, vba"},{"@type":"BreadcrumbList","@id":"https:\/\/craftcookcode.com\/?p=1550#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/craftcookcode.com#listItem","position":1,"name":"Home","item":"https:\/\/craftcookcode.com","nextItem":{"@type":"ListItem","@id":"https:\/\/craftcookcode.com\/?cat=13#listItem","name":"Code"}},{"@type":"ListItem","@id":"https:\/\/craftcookcode.com\/?cat=13#listItem","position":2,"name":"Code","item":"https:\/\/craftcookcode.com\/?cat=13","nextItem":{"@type":"ListItem","@id":"https:\/\/craftcookcode.com\/?cat=18#listItem","name":"Python"},"previousItem":{"@type":"ListItem","@id":"https:\/\/craftcookcode.com#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/craftcookcode.com\/?cat=18#listItem","position":3,"name":"Python","item":"https:\/\/craftcookcode.com\/?cat=18","nextItem":{"@type":"ListItem","@id":"https:\/\/craftcookcode.com\/?p=1550#listItem","name":"Python &amp; openpyxl &#8211;  If the fraud team tells you to do something; do it quickly!"},"previousItem":{"@type":"ListItem","@id":"https:\/\/craftcookcode.com\/?cat=13#listItem","name":"Code"}},{"@type":"ListItem","@id":"https:\/\/craftcookcode.com\/?p=1550#listItem","position":4,"name":"Python &amp; openpyxl &#8211;  If the fraud team tells you to do something; do it quickly!","previousItem":{"@type":"ListItem","@id":"https:\/\/craftcookcode.com\/?cat=18#listItem","name":"Python"}}]},{"@type":"Person","@id":"https:\/\/craftcookcode.com\/#person","name":"jonny.donker@gmail.com","image":{"@type":"ImageObject","@id":"https:\/\/craftcookcode.com\/?p=1550#personImage","url":"https:\/\/secure.gravatar.com\/avatar\/12ea7810156e378894993fa29611c905482263dd05898a50ae5ece294bb6aff0?s=96&d=mm&r=g","width":96,"height":96,"caption":"jonny.donker@gmail.com"}},{"@type":"Person","@id":"https:\/\/craftcookcode.com\/?author=1#author","url":"https:\/\/craftcookcode.com\/?author=1","name":"jonny.donker@gmail.com","image":{"@type":"ImageObject","@id":"https:\/\/craftcookcode.com\/?p=1550#authorImage","url":"https:\/\/secure.gravatar.com\/avatar\/12ea7810156e378894993fa29611c905482263dd05898a50ae5ece294bb6aff0?s=96&d=mm&r=g","width":96,"height":96,"caption":"jonny.donker@gmail.com"}},{"@type":"WebPage","@id":"https:\/\/craftcookcode.com\/?p=1550#webpage","url":"https:\/\/craftcookcode.com\/?p=1550","name":"Python & openpyxl \u2013 If the fraud team tells you to do something; do it quickly! - Craft Cook Code","description":"A member of our Fraud team contacted me unexpectedly at work. Hey. I got this excel workbook of a customer's statement with the data spread across multiple sheets. Do you know how to consolidate them into one sheet? \"OK,\" I thought, \"It can't be that hard.\" She sent me the workbook. It had 447 sheets","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/craftcookcode.com\/#website"},"breadcrumb":{"@id":"https:\/\/craftcookcode.com\/?p=1550#breadcrumblist"},"author":{"@id":"https:\/\/craftcookcode.com\/?author=1#author"},"creator":{"@id":"https:\/\/craftcookcode.com\/?author=1#author"},"image":{"@type":"ImageObject","url":"https:\/\/craftcookcode.com\/wp-content\/uploads\/2024\/10\/code_fraud_0.png","@id":"https:\/\/craftcookcode.com\/?p=1550\/#mainImage","width":498,"height":281},"primaryImageOfPage":{"@id":"https:\/\/craftcookcode.com\/?p=1550#mainImage"},"datePublished":"2024-10-25T05:42:10+00:00","dateModified":"2024-10-25T05:42:10+00:00"},{"@type":"WebSite","@id":"https:\/\/craftcookcode.com\/#website","url":"https:\/\/craftcookcode.com\/","name":"Craft Cook Code","description":"c^3?","inLanguage":"en-US","publisher":{"@id":"https:\/\/craftcookcode.com\/#person"}}]},"og:locale":"en_US","og:site_name":"Craft Cook Code - c^3?","og:type":"article","og:title":"Python &amp; openpyxl \u2013 If the fraud team tells you to do something; do it quickly! - Craft Cook Code","og:description":"A member of our Fraud team contacted me unexpectedly at work. Hey. I got this excel workbook of a customer's statement with the data spread across multiple sheets. Do you know how to consolidate them into one sheet? &quot;OK,&quot; I thought, &quot;It can't be that hard.&quot; She sent me the workbook. It had 447 sheets","og:url":"https:\/\/craftcookcode.com\/?p=1550","article:published_time":"2024-10-25T05:42:10+00:00","article:modified_time":"2024-10-25T05:42:10+00:00","twitter:card":"summary_large_image","twitter:title":"Python &amp; openpyxl \u2013 If the fraud team tells you to do something; do it quickly! - Craft Cook Code","twitter:description":"A member of our Fraud team contacted me unexpectedly at work. Hey. I got this excel workbook of a customer's statement with the data spread across multiple sheets. Do you know how to consolidate them into one sheet? &quot;OK,&quot; I thought, &quot;It can't be that hard.&quot; She sent me the workbook. It had 447 sheets"},"aioseo_meta_data":{"post_id":"1550","title":null,"description":null,"keywords":null,"keyphrases":{"focus":{"keyphrase":"","score":0,"analysis":{"keyphraseInTitle":{"score":0,"maxScore":9,"error":1}}},"additional":[]},"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":"","og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"BlogPosting","isEnabled":true},"graphs":[]},"schema_type":"default","schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":"-1","robots_max_videopreview":"-1","robots_max_imagepreview":"large","priority":null,"frequency":"default","local_seo":null,"breadcrumb_settings":null,"limit_modified_date":false,"ai":null,"created":"2024-10-25 05:09:53","updated":"2025-06-04 13:28:32","seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/craftcookcode.com\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/craftcookcode.com\/?cat=13\" title=\"Code\">Code<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/craftcookcode.com\/?cat=18\" title=\"Python\">Python<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tPython &amp; openpyxl \u2013  If the fraud team tells you to do something; do it quickly!\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/craftcookcode.com"},{"label":"Code","link":"https:\/\/craftcookcode.com\/?cat=13"},{"label":"Python","link":"https:\/\/craftcookcode.com\/?cat=18"},{"label":"Python &amp; openpyxl &#8211;  If the fraud team tells you to do something; do it quickly!","link":"https:\/\/craftcookcode.com\/?p=1550"}],"_links":{"self":[{"href":"https:\/\/craftcookcode.com\/index.php?rest_route=\/wp\/v2\/posts\/1550","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/craftcookcode.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/craftcookcode.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/craftcookcode.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/craftcookcode.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1550"}],"version-history":[{"count":3,"href":"https:\/\/craftcookcode.com\/index.php?rest_route=\/wp\/v2\/posts\/1550\/revisions"}],"predecessor-version":[{"id":1555,"href":"https:\/\/craftcookcode.com\/index.php?rest_route=\/wp\/v2\/posts\/1550\/revisions\/1555"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/craftcookcode.com\/index.php?rest_route=\/wp\/v2\/media\/1554"}],"wp:attachment":[{"href":"https:\/\/craftcookcode.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1550"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/craftcookcode.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1550"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/craftcookcode.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1550"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}