{"data":{"slug":"github-opensensenova-sensenova-skills-skills-sn-da-excel-workflow-capability-excel-reading-large-excel-reading-40fc8e6924b0","title":"Large Excel File Analysis and Formatted Report Generation","summary":"Process large Excel files, support Parquet format conversion for faster analysis, and generate formatted Excel reports with conditional highlighting and custom styles, along with download links.","url":"https:\/\/skillshunter.net\/skills\/github-opensensenova-sensenova-skills-skills-sn-da-excel-workflow-capability-excel-reading-large-excel-reading-40fc8e6924b0","json_url":"https:\/\/skillshunter.net\/api\/public\/v1\/skills\/github-opensensenova-sensenova-skills-skills-sn-da-excel-workflow-capability-excel-reading-large-excel-reading-40fc8e6924b0","markdown_url":"https:\/\/skillshunter.net\/skills\/github-opensensenova-sensenova-skills-skills-sn-da-excel-workflow-capability-excel-reading-large-excel-reading-40fc8e6924b0.md","download_url":"https:\/\/skillshunter.net\/skills\/github-opensensenova-sensenova-skills-skills-sn-da-excel-workflow-capability-excel-reading-large-excel-reading-40fc8e6924b0\/download","category":{"slug":"data-research","name":"Data & Research"},"editor_note":"The skill requires the user to provide the file path of the Excel file and specify the column names for grouping and target analysis. The output is a formatted Excel report with conditional highlighting and a download link.","instructions":"---\nname: large-excel-analysis-and-formatting\ndescription: \"\u7528\u4e8e\u5904\u7406\u591aSheet\u5927\u578bExcel\u6587\u4ef6\uff0c\u652f\u6301\u5927\u6587\u4ef6Parquet\u683c\u5f0f\u8f6c\u6362\u63d0\u901f\uff0c\u5e76\u4f7f\u7528openpyxl\u751f\u6210\u5e26\u6761\u4ef6\u9ad8\u4eae\u548c\u81ea\u5b9a\u4e49\u6837\u5f0f\u7684\u683c\u5f0f\u5316Excel\u62a5\u544a\u53ca\u4e0b\u8f7d\u94fe\u63a5\u3002\"\n---\n\n## Skill Steps\n\nStep1 \u8bfb\u53d6Excel\u6587\u4ef6\uff0c\u7edf\u8ba1\u6240\u6709Sheet\u7684\u603b\u884c\u6570\u3002\u82e5\u6570\u636e\u91cf\u8fc7\u5927\uff08\u5982\u22651\u4e07\u884c\uff09\uff0c\u5219\u8f6c\u6362\u4e3aParquet\u683c\u5f0f\u4ee5\u663e\u8457\u63d0\u5347\u540e\u7eed\u8bfb\u53d6\u548c\u5206\u6790\u6548\u7387\u3002\n```python\nimport pandas as pd\n\nfile_path = \"input.xlsx\"\nxls = pd.ExcelFile(file_path)\ntotal_rows = 0\n\n# \u7edf\u8ba1\u6240\u6709 sheet \u7684\u603b\u884c\u6570\nfor name in xls.sheet_names:\n    df_temp = pd.read_excel(file_path, sheet_name=name, header=None)\n    total_rows += len(df_temp)\n\nprint(f\"\u603b\u884c\u6570: {total_rows}\")\n\n# \u5927\u6587\u4ef6\u5904\u7406\uff1a\u8d85\u8fc7\u9608\u503c\u8f6c\u6362\u4e3a Parquet \u63d0\u5347\u6548\u7387\nif total_rows >= 10000:\n    parquet_path = \"\/mnt\/data\/temp.parquet\"\n    # \u6b64\u5904\u4ee5\u8bfb\u53d6\u7b2c\u4e00\u4e2asheet\u4e3a\u4f8b\uff0c\u5b9e\u9645\u53ef\u6839\u636e\u9700\u6c42\u5408\u5e76\u591a\u4e2asheet\n    df = pd.read_excel(file_path, sheet_name=0)\n    df.to_parquet(engine='pyarrow', path=parquet_path)\n    df = pd.read_parquet(parquet_path)\nelse:\n    df = pd.read_excel(file_path, sheet_name=0)\n```\n\nStep2 \u63d0\u53d6\u76ee\u6807\u6570\u636e\u8fdb\u884c\u5206\u7ec4\u6c47\u603b\u5206\u6790\uff0c\u5e76\u8bc6\u522b\u51fa\u6700\u5927\u503c\u53ca\u5176\u5bf9\u5e94\u7684\u5206\u7c7b\u9879\u3002\n```python\n# \u5360\u4f4d\u793a\u4f8b\uff1a\u6839\u636e\u5b9e\u9645\u6570\u636e\u96c6\u66ff\u6362\u5217\u540d\ngroup_col = '\u5206\u7c7b\u5217\u540d'  # \u5982 '\u63a7\u80a1\u7c7b\u578b'\ntarget_col = '\u76ee\u6807\u6570\u503c\u5217'  # \u5982 '\u5efa\u7b51\u4e1a\u603b\u4ea7\u503c'\n\n# \u5047\u8bbe df \u5df2\u6e05\u6d17\u5e76\u5305\u542b\u6240\u9700\u5217\uff0c\u8fdb\u884c\u6c47\u603b\u5206\u6790\nsummary = df.groupby(group_col)[target_col].sum().reset_index()\n\n# \u8bc6\u522b\u6700\u5927\u503c\u53ca\u5176\u5bf9\u5e94\u7684\u5206\u7c7b\nmax_idx = summary[target_col].idxmax()\nmax_type = summary.loc[max_idx, group_col]\nprint(f\"\u6700\u9ad8\u4ea7\u503c\u7c7b\u578b: {max_type}\")\n```\n\nStep3 \u4f7f\u7528 openpyxl \u5c06\u5206\u6790\u7ed3\u679c\u5199\u5165\u65b0\u7684Excel\u6587\u4ef6\uff0c\u914d\u7f6e\u8868\u5934\u6837\u5f0f\u3001\u8fb9\u6846\u3001\u5217\u5bbd\uff0c\u5e76\u5bf9\u6ee1\u8db3\u7279\u5b9a\u6761\u4ef6\uff08\u5982\u6700\u5927\u503c\uff09\u7684\u884c\u8fdb\u884c\u7eff\u8272\u9ad8\u4eae\u6807\u6ce8\uff0c\u6700\u540e\u751f\u6210\u4e0b\u8f7d\u94fe\u63a5\u3002\n```python\nfrom openpyxl import Workbook\nfrom openpyxl.styles import PatternFill, Font, Alignment, Border, Side\n\nwb = Workbook()\nws = wb.active\nws.title = \"\u5206\u6790\u62a5\u544a\"\n\n# \u6837\u5f0f\u5b9a\u4e49\nheader_fill = PatternFill(start_color=\"4472C4\", end_color=\"4472C4\", fill_type=\"solid\")\nheader_font = Font(name=\"\u5fae\u8f6f\u96c5\u9ed1\", bold=True, color=\"FFFFFF\", size=12)\nhighlight_fill = PatternFill(start_color=\"00B050\", end_color=\"00B050\", fill_type=\"solid\")\nhighlight_font = Font(name=\"\u5fae\u8f6f\u96c5\u9ed1\", bold=True, color=\"FFFFFF\", size=12)\nnormal_font = Font(name=\"\u5fae\u8f6f\u96c5\u9ed1\", size=11)\ncenter_align = Alignment(horizontal=\"center\", vertical=\"center\")\nthin_border = Border(\n    left=Side(style=\"thin\"), right=Side(style=\"thin\"),\n    top=Side(style=\"thin\"), bottom=Side(style=\"thin\")\n)\n\n# \u5199\u5165\u8868\u5934\u5e76\u5e94\u7528\u6837\u5f0f\nheaders = [group_col, target_col]\nfor col, header in enumerate(headers, 1):\n    cell = ws.cell(row=1, column=col, value=header)\n    cell.fill = header_fill\n    cell.font = header_font\n    cell.alignment = center_align\n    cell.border = thin_border\n\n# \u5199\u5165\u6570\u636e\u5e76\u8fdb\u884c\u6761\u4ef6\u9ad8\u4eae\nfor row_idx, row_data in enumerate(summary.itertuples(index=False), 2):\n    type_name, value = row_data[0], row_data[1]\n    \n    cell_type = ws.cell(row=row_idx, column=1, value=type_name)\n    cell_value = ws.cell(row=row_idx, column=2, value=value)\n    \n    # \u57fa\u7840\u6837\u5f0f\n    for cell in [cell_type, cell_value]:\n        cell.alignment = center_align\n        cell.border = thin_border\n        cell.font = normal_font\n    \n    # \u547d\u4e2d\u6700\u5927\u503c\u6761\u4ef6\u65f6\u9ad8\u4eae\u6574\u884c\n    if type_name == max_type:\n        cell_type.fill = highlight_fill\n        cell_type.font = highlight_font\n        cell_value.fill = highlight_fill\n        cell_value.font = highlight_font\n\n# \u8c03\u6574\u5217\u5bbd\nws.column_dimensions['A'].width = 18\nws.column_dimensions['B'].width = 25\n\n# \u4fdd\u5b58\u6587\u4ef6\noutput_path = \"\/mnt\/data\/formatted_analysis_report.xlsx\"\nwb.save(output_path)\nprint(f\"\u6587\u4ef6\u5df2\u4fdd\u5b58\u81f3: {output_path}\")\n\n# \u63d0\u4f9b\u4e0b\u8f7d\u94fe\u63a5\ndownload_link = f\"sandbox:{output_path}\"\nprint(f\"\u4e0b\u8f7d\u94fe\u63a5: {download_link}\")\n```\n","use_cases":["Process large Excel files with multiple sheets, count total rows, and convert to Parquet format to improve analysis efficiency.","Extract target data for grouping and summary analysis, identify maximum values and their corresponding categories.","Generate formatted Excel reports with conditional highlighting and custom styles, and provide download links."],"limitations":[],"compatibility":[],"setup_tip":null,"sample_input":null,"sample_output":null,"source_url":"https:\/\/github.com\/OpenSenseNova\/SenseNova-Skills\/blob\/07e7ff8c4bdfd7b79e7402fe94af59d2a5a9749b\/skills\/sn-da-excel-workflow\/capability\/excel-reading\/large-excel-reading\/SKILL.md","source_commit":"07e7ff8c4bdfd7b79e7402fe94af59d2a5a9749b","license":null,"version":null,"listing_approved_at":"2026-11-16","created_at":"2026-11-15T09:08:52.000000Z","updated_at":"2026-11-16T05:16:30.000000Z","seo_title":"Large Excel Analysis and Formatted Report Generation","seo_description":"Efficiently process large Excel files and generate formatted analysis reports with conditional highlighting and styles, along with download links.","seo_keywords":["Large Excel Analysis","Excel Formatted Report","Parquet Format Conversion","Data Highlighting","Excel Download Link"]}}