Pdf excel pivot report

From XuShuwenn/RedAct · View interactive version

Pdf excel pivot report is an AI agent skill from the GitHub repository XuShuwenn/RedAct. Create Excel reports with pivot-style summaries by extracting tables from PDFs, merging with spreadsheets, cleaning types, adding derived quartiles, and verifying outputs.

How to use this skill

Skill file

PDF + Excel to Pivot Report

Build a multi-sheet Excel report by extracting tabular data from a PDF, merging it with a spreadsheet, enriching with derived fields (income quartiles and totals), and generating four summary sheets plus a SourceData sheet.

This workflow generalizes to any task that requires: parsing tabular PDF data, joining with an Excel dataset, normalizing types and keys, computing quartile labels, and producing pivot-style summaries.

When to Use

Use this skill when you need to:

Core Workflow

1) Inspect Inputs and Plan

2) Extract PDF Tables Robustly

3) Load Spreadsheet Data

4) Normalize Join Keys Before Merging

5) Merge and Validate

6) Derive Fields

7) Build the Excel Report (5 sheets)

Implementation options for summaries:

8) Save and Verify

Verification

Perform these checks before finalizing:

Common Pitfalls and How to Avoid Them

Success Criteria

Optional Script Usage

The helper script provides reusable utilities to coerce numeric columns, normalize join keys, assign robust quartile labels, and write a report with aggregated summary sheets. Import and use it in your pipeline after you’ve prepared a merged DataFrame named df with at least these columns (rename as needed in your code):

Example (Python):

from scripts.pivot_tools import (
    coerce_numeric, normalize_key, assign_quartiles,
    write_aggregated_report
)

# Assume df is your merged DataFrame
for col in ["EARNERS", "MEDIAN_INCOME", "POPULATION_2023"]:
    df[col] = coerce_numeric(df[col])

# Normalize join key (if needed) and state
df["REGION_ID"] = normalize_key(df["REGION_ID"], zero_pad=None)

df["Quarter"] = assign_quartiles(df["MEDIAN_INCOME"], labels=("Q1","Q2","Q3","Q4"))
df["Total"] = df["EARNERS"] * df["MEDIAN_INCOME"]

write_aggregated_report(
    df=df,
    output_path="demographic_analysis.xlsx",
    state_col="STATE",
    region_col="REGION_ID",
    population_col="POPULATION_2023",
    earners_col="EARNERS",
    quarter_col="Quarter"
)

If you need true Excel pivot tables and your environment supports them (xlsxwriter), adapt the script to write_excel_with_pivots using the same columns; otherwise the aggregated report will meet most validation needs.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.