{"product_id":"claude-skills-tạo-excel-powerpoint-pdf-tự-dộng","title":"Claude Skills — Tạo Excel, PowerPoint, PDF tự động","description":"\n\u003cp\u003eMột trong những use case phổ biến nhất trong doanh nghiệp: tạo tài liệu lặp đi lặp lại. Báo cáo hàng tuần, slide cập nhật cho management, invoice tháng — những tác vụ này tốn hàng giờ mỗi tuần. \u003cstrong\u003eClaude Skills cho document generation\u003c\/strong\u003e giúp bạn tự động hóa hoàn toàn quy trình này.\u003c\/p\u003e\n\n\u003ch2\u003eClaude Skills là gì?\u003c\/h2\u003e\n\n\u003cp\u003eSkills là các tool đặc biệt cho phép Claude thực hiện actions cụ thể vượt ra ngoài việc tạo text. Với document generation skills, Claude có thể:\u003c\/p\u003e\n\n\u003cul\u003e\n  \u003cli\u003eTạo file \u003cstrong\u003eExcel (.xlsx)\u003c\/strong\u003e với formulas, charts, và conditional formatting\u003c\/li\u003e\n  \u003cli\u003eTạo file \u003cstrong\u003ePowerPoint (.pptx)\u003c\/strong\u003e với layouts, images, và animations\u003c\/li\u003e\n  \u003cli\u003eTạo file \u003cstrong\u003ePDF\u003c\/strong\u003e với typography và layout chuyên nghiệp\u003c\/li\u003e\n  \u003cli\u003eĐiền vào templates có sẵn với dữ liệu động\u003c\/li\u003e\n\u003c\/ul\u003e\n\n\u003ch2\u003eSetup: Cài đặt thư viện cần thiết\u003c\/h2\u003e\n\n\u003cpre\u003e\u003ccode\u003epip install openpyxl python-pptx reportlab anthropic\u003c\/code\u003e\u003c\/pre\u003e\n\n\u003ch2\u003eTạo Excel với Python + Claude\u003c\/h2\u003e\n\n\u003cp\u003ePattern hiệu quả nhất: Claude tạo \u003cem\u003ecode\u003c\/em\u003e để generate Excel, sau đó bạn execute code đó:\u003c\/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eimport anthropic\nimport subprocess\nimport tempfile\nimport os\n\nclient = anthropic.Anthropic()\n\ndef generate_excel_report(data_description: str, output_path: str):\n    \"\"\"Claude tạo code Python để build Excel file\"\"\"\n\n    response = client.messages.create(\n        model=\"claude-opus-4-5\",\n        max_tokens=4000,\n        system=\"\"\"You are an expert Python developer specializing in Excel automation with openpyxl.\nWrite complete, runnable Python code that creates professional Excel files.\nAlways include: proper formatting, headers, borders, column widths, and data validation where appropriate.\"\"\",\n        messages=[{\n            \"role\": \"user\",\n            \"content\": f\"\"\"Write Python code using openpyxl to create an Excel file.\n\nRequirements:\n{data_description}\n\nOutput path: {output_path}\n\nThe code must:\n1. Create the workbook and sheets\n2. Add headers with styling (bold, background color)\n3. Add sample\/placeholder data rows\n4. Set appropriate column widths\n5. Add borders and alternating row colors\n6. Save to the output path\n\nWrite ONLY the Python code, no explanations.\"\"\"\n        }]\n    )\n\n    code = response.content[0].text\n\n    # Extract Python code nếu có markdown\n    if \"'''python\" in code:\n        code = code.split(\"'''python\")[1].split(\"'''\")[0]\n    elif \"'''\" in code:\n        code = code.split(\"'''\")[1].split(\"'''\")[0]\n\n    # Execute code trong temp file\n    with tempfile.NamedTemporaryFile(mode='w', suffix='.py', delete=False) as f:\n        f.write(code)\n        temp_path = f.name\n\n    try:\n        result = subprocess.run(['python', temp_path], capture_output=True, text=True)\n        if result.returncode != 0:\n            return {\"success\": False, \"error\": result.stderr, \"code\": code}\n        return {\"success\": True, \"path\": output_path, \"code\": code}\n    finally:\n        os.unlink(temp_path)\n\n# Sử dụng\nresult = generate_excel_report(\n    data_description=\"\"\"\n    Quarterly Sales Report with:\n    - Sheet 1: Summary with KPIs (Revenue, Units Sold, Avg Order Value, Growth %)\n    - Sheet 2: Monthly breakdown table (Jan-Dec) for each product category\n    - Sheet 3: Top 10 customers table with: name, total spend, orders, last order date\n    - All monetary values formatted as currency (USD)\n    - Conditional formatting: green for positive growth, red for negative\n    \"\"\",\n    output_path=\"\/tmp\/quarterly_report.xlsx\"\n)\n\nprint(f\"Excel created: {result['path']}\" if result['success'] else f\"Error: {result['error']}\")\u003c\/code\u003e\u003c\/pre\u003e\n\n\u003ch2\u003eTạo Excel trực tiếp với openpyxl\u003c\/h2\u003e\n\n\u003cp\u003eKhi bạn có data cụ thể và muốn kiểm soát nhiều hơn:\u003c\/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eimport openpyxl\nfrom openpyxl.styles import Font, PatternFill, Alignment, Border, Side\nfrom openpyxl.utils import get_column_letter\nfrom openpyxl.chart import BarChart, Reference\n\ndef create_sales_dashboard(data: dict, output_path: str):\n    \"\"\"Tạo Excel dashboard với data thực tế\"\"\"\n    wb = openpyxl.Workbook()\n\n    # === Sheet 1: Summary ===\n    ws_summary = wb.active\n    ws_summary.title = \"Summary\"\n\n    # Header styling\n    header_font = Font(bold=True, color=\"FFFFFF\", size=12)\n    header_fill = PatternFill(start_color=\"2E4057\", end_color=\"2E4057\", fill_type=\"solid\")\n    header_alignment = Alignment(horizontal=\"center\", vertical=\"center\")\n\n    headers = [\"Metric\", \"Q1\", \"Q2\", \"Q3\", \"Q4\", \"Total\"]\n    for col, header in enumerate(headers, 1):\n        cell = ws_summary.cell(row=1, column=col, value=header)\n        cell.font = header_font\n        cell.fill = header_fill\n        cell.alignment = header_alignment\n\n    # Data rows\n    metrics = data.get(\"metrics\", [\n        {\"name\": \"Revenue ($)\", \"values\": [125000, 142000, 158000, 189000]},\n        {\"name\": \"Units Sold\", \"values\": [1250, 1420, 1580, 1890]},\n        {\"name\": \"New Customers\", \"values\": [45, 52, 61, 78]},\n    ])\n\n    alt_fill = PatternFill(start_color=\"F0F4F8\", end_color=\"F0F4F8\", fill_type=\"solid\")\n\n    for row_idx, metric in enumerate(metrics, 2):\n        ws_summary.cell(row=row_idx, column=1, value=metric[\"name\"])\n        total = 0\n        for col_idx, val in enumerate(metric[\"values\"], 2):\n            cell = ws_summary.cell(row=row_idx, column=col_idx, value=val)\n            total += val\n            if row_idx % 2 == 0:\n                cell.fill = alt_fill\n\n        total_cell = ws_summary.cell(row=row_idx, column=6, value=total)\n        total_cell.font = Font(bold=True)\n\n    # Auto-fit columns\n    for col in ws_summary.columns:\n        max_width = max(len(str(cell.value or \"\")) for cell in col) + 4\n        ws_summary.column_dimensions[get_column_letter(col[0].column)].width = max_width\n\n    # === Sheet 2: Chart ===\n    ws_chart = wb.create_sheet(\"Charts\")\n\n    # Add data for chart\n    chart_data = [[\"Quarter\", \"Revenue\"]]\n    quarters = [\"Q1\", \"Q2\", \"Q3\", \"Q4\"]\n    revenues = [125000, 142000, 158000, 189000]\n    for q, r in zip(quarters, revenues):\n        chart_data.append([q, r])\n\n    for row in chart_data:\n        ws_chart.append(row)\n\n    # Create bar chart\n    chart = BarChart()\n    chart.type = \"col\"\n    chart.title = \"Quarterly Revenue\"\n    chart.y_axis.title = \"Revenue ($)\"\n    chart.x_axis.title = \"Quarter\"\n\n    data_ref = Reference(ws_chart, min_col=2, min_row=1, max_row=5)\n    cats = Reference(ws_chart, min_col=1, min_row=2, max_row=5)\n    chart.add_data(data_ref, titles_from_data=True)\n    chart.set_categories(cats)\n    chart.shape = 4\n\n    ws_chart.add_chart(chart, \"D2\")\n\n    wb.save(output_path)\n    return output_path\n\n# Tạo file\ncreate_sales_dashboard({}, \"\/tmp\/sales_dashboard.xlsx\")\u003c\/code\u003e\u003c\/pre\u003e\n\n\u003ch2\u003eTạo PowerPoint với python-pptx\u003c\/h2\u003e\n\n\u003cpre\u003e\u003ccode\u003efrom pptx import Presentation\nfrom pptx.util import Inches, Pt, Emu\nfrom pptx.dml.color import RGBColor\nfrom pptx.enum.text import PP_ALIGN\n\ndef create_presentation(content: dict, output_path: str):\n    \"\"\"Tạo PowerPoint từ structured content\"\"\"\n    prs = Presentation()\n\n    # Slide dimensions (widescreen 16:9)\n    prs.slide_width = Inches(13.33)\n    prs.slide_height = Inches(7.5)\n\n    # Colors\n    PRIMARY = RGBColor(0x2E, 0x40, 0x57)\n    ACCENT = RGBColor(0x06, 0x8D, 0x9D)\n    WHITE = RGBColor(0xFF, 0xFF, 0xFF)\n\n    def add_title_slide(title: str, subtitle: str):\n        layout = prs.slide_layouts[0]\n        slide = prs.slides.add_slide(layout)\n\n        title_shape = slide.shapes.title\n        title_shape.text = title\n        title_shape.text_frame.paragraphs[0].font.color.rgb = WHITE\n        title_shape.text_frame.paragraphs[0].font.size = Pt(44)\n        title_shape.text_frame.paragraphs[0].font.bold = True\n\n        subtitle_shape = slide.placeholders[1]\n        subtitle_shape.text = subtitle\n\n    def add_content_slide(title: str, bullets: list[str]):\n        layout = prs.slide_layouts[1]\n        slide = prs.slides.add_slide(layout)\n\n        slide.shapes.title.text = title\n\n        tf = slide.placeholders[1].text_frame\n        tf.clear()\n\n        for i, bullet in enumerate(bullets):\n            if i == 0:\n                p = tf.paragraphs[0]\n            else:\n                p = tf.add_paragraph()\n            p.text = bullet\n            p.level = 0\n            p.font.size = Pt(20)\n\n    def add_stats_slide(title: str, stats: list[dict]):\n        \"\"\"Slide với big number statistics\"\"\"\n        layout = prs.slide_layouts[6]  # Blank\n        slide = prs.slides.add_slide(layout)\n\n        # Title\n        txBox = slide.shapes.add_textbox(Inches(0.5), Inches(0.3), Inches(12), Inches(1))\n        tf = txBox.text_frame\n        tf.text = title\n        tf.paragraphs[0].font.size = Pt(32)\n        tf.paragraphs[0].font.bold = True\n\n        # Stats boxes\n        box_width = Inches(2.8)\n        for i, stat in enumerate(stats[:4]):\n            left = Inches(0.5 + i * 3.1)\n            top = Inches(2.0)\n\n            # Number\n            num_box = slide.shapes.add_textbox(left, top, box_width, Inches(1.5))\n            tf = num_box.text_frame\n            tf.text = stat[\"value\"]\n            tf.paragraphs[0].font.size = Pt(48)\n            tf.paragraphs[0].font.bold = True\n            tf.paragraphs[0].font.color.rgb = ACCENT\n            tf.paragraphs[0].alignment = PP_ALIGN.CENTER\n\n            # Label\n            label_box = slide.shapes.add_textbox(left, Inches(3.6), box_width, Inches(0.8))\n            tf = label_box.text_frame\n            tf.text = stat[\"label\"]\n            tf.paragraphs[0].alignment = PP_ALIGN.CENTER\n\n    # Build presentation\n    add_title_slide(\n        content.get(\"title\", \"Company Report\"),\n        content.get(\"subtitle\", \"Q4 2024\")\n    )\n\n    for slide_data in content.get(\"slides\", []):\n        if slide_data[\"type\"] == \"bullets\":\n            add_content_slide(slide_data[\"title\"], slide_data[\"bullets\"])\n        elif slide_data[\"type\"] == \"stats\":\n            add_stats_slide(slide_data[\"title\"], slide_data[\"stats\"])\n\n    prs.save(output_path)\n    return output_path\n\n# Ví dụ sử dụng\ncontent = {\n    \"title\": \"Annual Business Review 2024\",\n    \"subtitle\": \"Growth \u0026amp; Strategy Update\",\n    \"slides\": [\n        {\n            \"type\": \"stats\",\n            \"title\": \"Key Performance Indicators\",\n            \"stats\": [\n                {\"value\": \"$2.4M\", \"label\": \"Total Revenue\"},\n                {\"value\": \"89%\", \"label\": \"Customer Retention\"},\n                {\"value\": \"342\", \"label\": \"New Clients\"},\n                {\"value\": \"+34%\", \"label\": \"YoY Growth\"}\n            ]\n        },\n        {\n            \"type\": \"bullets\",\n            \"title\": \"2025 Strategic Priorities\",\n            \"bullets\": [\n                \"Expand into Southeast Asian markets\",\n                \"Launch AI-powered product features\",\n                \"Grow enterprise customer segment\",\n                \"Achieve profitability by Q3\"\n            ]\n        }\n    ]\n}\n\ncreate_presentation(content, \"\/tmp\/annual_review.pptx\")\u003c\/code\u003e\u003c\/pre\u003e\n\n\u003ch2\u003eKết hợp Claude để tạo nội dung + tài liệu\u003c\/h2\u003e\n\n\u003cp\u003ePattern mạnh nhất: Claude tạo cả nội dung lẫn structure:\u003c\/p\u003e\n\n\u003cpre\u003e\u003ccode\u003edef ai_powered_report(topic: str, data_points: list[str], output_path: str):\n    \"\"\"Claude tạo nội dung, Python tạo file\"\"\"\n\n    # Bước 1: Claude lên kế hoạch nội dung\n    content_response = client.messages.create(\n        model=\"claude-opus-4-5\",\n        max_tokens=3000,\n        messages=[{\n            \"role\": \"user\",\n            \"content\": f\"\"\"Create a structured report outline for: {topic}\n\nData available:\n{chr(10).join(data_points)}\n\nReturn JSON with structure:\n{{\n  \"title\": \"...\",\n  \"subtitle\": \"...\",\n  \"executive_summary\": \"2-3 sentences\",\n  \"slides\": [\n    {{\n      \"type\": \"bullets|stats\",\n      \"title\": \"...\",\n      \"bullets\": [\"...\"] or \"stats\": [{{\"value\": \"...\", \"label\": \"...\"}}]\n    }}\n  ]\n}}\"\"\"\n        }]\n    )\n\n    try:\n        text = content_response.content[0].text\n        start = text.find('{')\n        end = text.rfind('}') + 1\n        content = json.loads(text[start:end])\n    except Exception:\n        content = {\"title\": topic, \"slides\": []}\n\n    # B��ớc 2: Tạo PowerPoint\n    create_presentation(content, output_path)\n    return output_path\u003c\/code\u003e\u003c\/pre\u003e\n\n\u003ch2\u003eTổng kết\u003c\/h2\u003e\n\n\u003cp\u003eDocument automation với Claude và Python libraries mang lại lợi thế lớn:\u003c\/p\u003e\n\n\u003cul\u003e\n  \u003cli\u003e\n\u003cstrong\u003eopenpyxl\u003c\/strong\u003e cho Excel với full control over formatting, formulas, charts\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003epython-pptx\u003c\/strong\u003e cho PowerPoint với custom layouts và styling\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eClaude\u003c\/strong\u003e làm \"brain\" — quyết định nội dung, structure, và format phù hợp\u003c\/li\u003e\n\u003c\/ul\u003e\n\n\u003cp\u003eKhám phá tiếp: \u003ca href=\"\/collections\/ung-dung\"\u003eClaude Skills cho Tài chính\u003c\/a\u003e — dashboard và phân tích portfolio tự động.\u003c\/p\u003e\n\n\u003chr\u003e\n\u003ch3\u003eBài viết liên quan\u003c\/h3\u003e\n\u003cul\u003e\n\u003cli\u003e\u003ca href=\"\/products\/computer-use-demo-claude-di%E1%BB%81u-khi%E1%BB%83n-may-tinh-c%E1%BB%A7a-b%E1%BA%A1n\"\u003eComputer Use Demo — Claude điều khiển máy tính của bạn\u003c\/a\u003e\u003c\/li\u003e\n\u003cli\u003e\u003ca href=\"\/products\/claude-skills-cho-tai-chinh-dashboard-portfolio-phan-tich\"\u003eClaude Skills cho Tài chính — Dashboard, portfolio, phân tích\u003c\/a\u003e\u003c\/li\u003e\n\u003cli\u003e\u003ca href=\"\/products\/chuy%E1%BB%83n-t%E1%BB%AB-openai-agents-sdk-sang-claude-h%C6%B0%E1%BB%9Bng-d%E1%BA%ABn-migration-chi-ti%E1%BA%BFt\"\u003eChuyển từ OpenAI Agents SDK sang Claude — Hướng dẫn migration chi tiết\u003c\/a\u003e\u003c\/li\u003e\n\u003cli\u003e\u003ca href=\"\/products\/claude-cho-engineering-thi%E1%BA%BFt-k%E1%BA%BF-ki%E1%BA%BFn-truc-h%E1%BB%87-th%E1%BB%91ng\"\u003eClaude cho Engineering: Thiết kế kiến trúc hệ thống\u003c\/a\u003e\u003c\/li\u003e\n\u003cli\u003e\u003ca href=\"\/products\/claude-cho-data-vi%E1%BA%BFt-database-queries-t%E1%BB%AB-ngon-ng%E1%BB%AF-t%E1%BB%B1-nhien\"\u003eClaude cho Data: Viết database queries từ ngôn ngữ tự nhiên\u003c\/a\u003e\u003c\/li\u003e\n\u003c\/ul\u003e","brand":"Minh Tuấn","offers":[{"title":"Default Title","offer_id":47721898213588,"sku":null,"price":0.0,"currency_code":"VND","in_stock":true}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/0821\/0264\/9044\/files\/claude-skills-t_o-excel-powerpoint-pdf-t_-d_ng_2eb5fe0d-177c-46ac-ba33-cdaff442213c.jpg?v=1774521768","url":"https:\/\/claude.vn\/products\/claude-skills-t%e1%ba%a1o-excel-powerpoint-pdf-t%e1%bb%b1-d%e1%bb%99ng","provider":"CLAUDE.VN","version":"1.0","type":"link"}