{"data":{"slug":"github-opensensenova-sensenova-skills-skills-sn-da-excel-workflow-capability-excel-result-export-single-sheet-export-8a94e234b141","title":"Excel Data Filtering and Export","summary":"Filter Excel data based on specific conditions, rename fields, and export to a new file. Ideal for multi-sheet data exploration and conditional filtering export scenarios.","url":"https:\/\/skillshunter.net\/skills\/github-opensensenova-sensenova-skills-skills-sn-da-excel-workflow-capability-excel-result-export-single-sheet-export-8a94e234b141","json_url":"https:\/\/skillshunter.net\/api\/public\/v1\/skills\/github-opensensenova-sensenova-skills-skills-sn-da-excel-workflow-capability-excel-result-export-single-sheet-export-8a94e234b141","markdown_url":"https:\/\/skillshunter.net\/skills\/github-opensensenova-sensenova-skills-skills-sn-da-excel-workflow-capability-excel-result-export-single-sheet-export-8a94e234b141.md","download_url":"https:\/\/skillshunter.net\/skills\/github-opensensenova-sensenova-skills-skills-sn-da-excel-workflow-capability-excel-result-export-single-sheet-export-8a94e234b141\/download","category":{"slug":"data-research","name":"Data & Research"},"editor_note":"The skill requires a Python environment with pandas installed to process and export Excel files. The user must provide the file path and specify the target sheet name for processing.","instructions":"---\nname: excel-sheet-filter-export\ndescription: \"\u52a8\u6001\u7edf\u8ba1\u591aSheet Excel\u6587\u4ef6\u884c\u6570\u4ee5\u5224\u65ad\u5927\u6587\u4ef6\u5904\u7406\u903b\u8f91\uff0c\u5e76\u6839\u636e\u7279\u5b9a\u6761\u4ef6\u7b5b\u9009\u6570\u636e\u3001\u91cd\u547d\u540d\u5b57\u6bb5\u540e\u5bfc\u51fa\u4e3a\u5305\u542b\u4e0b\u8f7d\u94fe\u63a5\u7684\u65b0Excel\u6587\u4ef6\uff0c\u9002\u7528\u4e8e\u591aSheet\u6570\u636e\u63a2\u67e5\u4e0e\u6761\u4ef6\u8fc7\u6ee4\u5bfc\u51fa\u573a\u666f\u3002\"\n---\n\n## Skill Steps\n\n> This sub-skill covers one capability of the Excel workflow. For reading\/counting\/Parquet optimization, see the parent workflow SKILL.md.\n\nStep1 \u8bfb\u53d6\u76ee\u6807Sheet\uff0c\u6e05\u7406\u5b57\u6bb5\u683c\u5f0f\u5e76\u6839\u636e\u7279\u5b9a\u6761\u4ef6\u7b5b\u9009\u8bb0\u5f55\uff0c\u7edf\u8ba1\u5173\u952e\u6307\u6807\u3002\n```python\ntarget_sheet = 'Sheet1' # \u66ff\u6362\u4e3a\u5b9e\u9645sheet\u540d\ndf_target = pd.read_excel(file_path, sheet_name=target_sheet)\n\n# \u6e05\u7406\u76ee\u6807\u5217\u7684\u5b57\u7b26\u4e32\u683c\u5f0f\uff08\u53bb\u9664\u9996\u5c3e\u7a7a\u683c\uff09\nfilter_col = 'group_col'\nif filter_col in df_target.columns:\n    df_target[filter_col] = df_target[filter_col].astype(str).str.strip()\n\n# \u7b5b\u9009\u7b26\u5408\u6761\u4ef6\u7684\u8bb0\u5f55\ntarget_value = 'target_value_example'\nmask = df_target[filter_col] == target_value\ndf_filtered = df_target[mask]\n\n# \u7edf\u8ba1\u7279\u5b9a\u8303\u56f4\u7684\u79cd\u7c7b\u6570\u91cf\ntarget_col = 'target_col'\nif target_col in df_filtered.columns:\n    specific_ranges = df_filtered[target_col].dropna().unique()\n    print(f\"{target_col} \u79cd\u7c7b\u6570\u91cf:\", len(specific_ranges))\n    \n    # \u7edf\u8ba1\u5404\u5206\u7c7b\u6570\u91cf\u4e0e\u5360\u6bd4\n    value_counts_df = df_filtered[target_col].value_counts().reset_index()\n    value_counts_df.columns = [target_col, '\u6570\u91cf']\n    value_counts_df['\u5360\u6bd4'] = (value_counts_df['\u6570\u91cf'] \/ value_counts_df['\u6570\u91cf'].sum()).map('{:.2%}'.format)\n    \n    # \u6dfb\u52a0\u603b\u8ba1\u884c\n    total_row = pd.DataFrame({\n        target_col: ['\u603b\u8ba1'], \n        '\u6570\u91cf': [value_counts_df['\u6570\u91cf'].sum()], \n        '\u5360\u6bd4': ['100.00%']\n    })\n    value_counts_df = pd.concat([value_counts_df, total_row], ignore_index=True)\n    print(f\"\\n{target_col} \u5206\u5e03\u60c5\u51b5:\\n\", value_counts_df.head())\n```\n\nStep2 \u63d0\u53d6\u6240\u9700\u5b57\u6bb5\uff0c\u5bf9\u7ed3\u679c\u8fdb\u884c\u5b57\u6bb5\u91cd\u547d\u540d\u4e0e\u683c\u5f0f\u5316\u5904\u7406\uff0c\u4fdd\u5b58\u4e3a\u65b0\u7684Excel\u6587\u4ef6\u5e76\u751f\u6210\u4e0b\u8f7d\u94fe\u63a5\u3002\n```python\n# \u63d0\u53d6\u9700\u8981\u7684\u5217\u5e76\u91cd\u547d\u540d\nselected_cols = ['col1', 'col2', filter_col, target_col]\n# \u786e\u4fdd\u5217\u5b58\u5728\nexisting_cols = [col for col in selected_cols if col in df_filtered.columns]\nresult_df = df_filtered[existing_cols].copy()\n\n# \u5b57\u6bb5\u91cd\u547d\u540d\u6620\u5c04\u5b57\u5178\nrename_mapping = {\n    'col1': '\u91cd\u547d\u540d\u52171',\n    'col2': '\u91cd\u547d\u540d\u52172',\n    filter_col: '\u7b5b\u9009\u7ef4\u5ea6',\n    target_col: '\u5206\u6790\u7ef4\u5ea6'\n}\nresult_df = result_df.rename(columns=rename_mapping)\n\n# \u4fdd\u5b58\u7ed3\u679c\u5e76\u63d0\u4f9b\u4e0b\u8f7d\u94fe\u63a5\noutput_path = \"filtered_result_output.xlsx\"\nresult_df.to_excel(output_path, index=False)\nprint(\"\u7ed3\u679c\u5df2\u4fdd\u5b58\u81f3:\", output_path)\nprint(f\"[\u4e0b\u8f7d\u7ed3\u679c\u6587\u4ef6](sandbox:{output_path})\")\n```\n","use_cases":["Filter data from a specific sheet and export to a new file","Perform conditional filtering on multi-sheet data and generate a statistical report","Clean field formats and export to a structured Excel file"],"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-result-export\/single-sheet-export\/SKILL.md","source_commit":"07e7ff8c4bdfd7b79e7402fe94af59d2a5a9749b","license":null,"version":null,"listing_approved_at":"2026-11-16","created_at":"2026-11-15T09:53:34.000000Z","updated_at":"2026-11-16T05:16:30.000000Z","seo_title":"Excel Data Filtering and Export Tool","seo_description":"Filter Excel data based on conditions, rename fields, and export to a new file. Suitable for multi-sheet data exploration and conditional filtering export scenarios.","seo_keywords":["Excel data filtering","conditional filtering export","field renaming export","multi-sheet data processing","Excel file cleaning"]}}