openpyxl-5-large-dataset-handling-with-streaming

Sub-skill of openpyxl: 5. Large Dataset Handling with Streaming.

5 stars

Best use case

openpyxl-5-large-dataset-handling-with-streaming is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Sub-skill of openpyxl: 5. Large Dataset Handling with Streaming.

Teams using openpyxl-5-large-dataset-handling-with-streaming should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/5-large-dataset-handling-with-streaming/SKILL.md --create-dirs "https://raw.githubusercontent.com/vamseeachanta/workspace-hub/main/.agents/skills/_archive/data/office/openpyxl/5-large-dataset-handling-with-streaming/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/5-large-dataset-handling-with-streaming/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How openpyxl-5-large-dataset-handling-with-streaming Compares

Feature / Agentopenpyxl-5-large-dataset-handling-with-streamingStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Sub-skill of openpyxl: 5. Large Dataset Handling with Streaming.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# 5. Large Dataset Handling with Streaming

## 5. Large Dataset Handling with Streaming


```python
"""
Handle large datasets efficiently with read-only and write-only modes.
"""
from openpyxl import Workbook, load_workbook
from openpyxl.utils import get_column_letter
from typing import Generator, List, Dict, Any, Iterator
import time

def write_large_dataset_streaming(
    output_path: str,
    data_generator: Generator,
    headers: List[str],
    chunk_size: int = 10000
) -> int:
    """Write large dataset using write-only mode for memory efficiency."""
    # Use write_only mode for streaming
    wb = Workbook(write_only=True)
    ws = wb.create_sheet("Large Data")

    # Write headers
    ws.append(headers)

    rows_written = 0
    start_time = time.time()

    for row in data_generator:
        ws.append(row)
        rows_written += 1

        if rows_written % chunk_size == 0:
            elapsed = time.time() - start_time
            print(f"Written {rows_written:,} rows ({elapsed:.1f}s)")

    wb.save(output_path)

    total_time = time.time() - start_time
    print(f"Total: {rows_written:,} rows written in {total_time:.1f}s")

    return rows_written


def read_large_dataset_streaming(
    file_path: str,
    chunk_size: int = 1000
) -> Generator:
    """Read large dataset using read-only mode for memory efficiency."""
    # Use read_only mode for streaming
    wb = load_workbook(file_path, read_only=True)
    ws = wb.active

    chunk = []
    headers = None

    for row_idx, row in enumerate(ws.iter_rows(values_only=True)):
        if row_idx == 0:
            headers = row
            continue

        # Convert row to dictionary
        row_dict = dict(zip(headers, row))
        chunk.append(row_dict)

        if len(chunk) >= chunk_size:
            yield chunk
            chunk = []

    if chunk:
        yield chunk

    wb.close()


def generate_sample_data(num_rows: int) -> Generator:
    """Generate sample data for testing."""
    import random
    from datetime import datetime, timedelta

    base_date = datetime(2026, 1, 1)
    categories = ["Electronics", "Clothing", "Food", "Books", "Home"]
    regions = ["North", "South", "East", "West"]

    for i in range(num_rows):
        yield [
            i + 1,  # ID
            f"Product_{i+1}",  # Product Name
            random.choice(categories),  # Category
            random.choice(regions),  # Region
            round(random.uniform(10, 1000), 2),  # Price
            random.randint(1, 100),  # Quantity
            (base_date + timedelta(days=random.randint(0, 365))).strftime("%Y-%m-%d"),  # Date
        ]


def process_large_file_example() -> None:
    """Example of processing large Excel files."""
    # Generate large dataset
    headers = ["ID", "Product", "Category", "Region", "Price", "Quantity", "Date"]
    num_rows = 100000  # 100k rows

    print(f"Generating {num_rows:,} rows...")
    output_path = "large_dataset.xlsx"

    # Write large file
    rows_written = write_large_dataset_streaming(
        output_path,
        generate_sample_data(num_rows),
        headers
    )

    # Read and process in chunks
    print(f"\nReading file in chunks...")
    total_revenue = 0
    category_totals = {}

    for chunk in read_large_dataset_streaming(output_path, chunk_size=5000):
        for row in chunk:
            revenue = row['Price'] * row['Quantity']
            total_revenue += revenue

            category = row['Category']
            category_totals[category] = category_totals.get(category, 0) + revenue

    print(f"\nTotal Revenue: ${total_revenue:,.2f}")
    print("\nRevenue by Category:")
    for category, total in sorted(category_totals.items()):
        print(f"  {category}: ${total:,.2f}")


# process_large_file_example()
```

Related Skills

tax-form-currency-field-handling

5
from vamseeachanta/workspace-hub

Handle currency field rounding and formatting quirks when entering precise decimal values into tax software forms

git-large-file-staging-conflict-recovery

5
from vamseeachanta/workspace-hub

Recover from pre-commit hook blocks on oversized files and corrupted rebase states during bulk repo syncs

bash-pipefail-grep-error-handling

5
from vamseeachanta/workspace-hub

Handle grep exit codes safely under set -eo pipefail by isolating pipeline failure scope

large-parallel-planning-wave-environment-failure-handoff

5
from vamseeachanta/workspace-hub

Handle large pre-plan-review planning waves that succeed analytically but fail to persist artifacts due to quota exhaustion, sandbox write failures, or cancelled GitHub mutations.

large-lint-gate-restoration-wave

5
from vamseeachanta/workspace-hub

Restore a red repository Lint job when flake8 debt is large and mixed, by inventorying outliers, splitting issue ownership, using local direct-venv iteration, inspecting broad auto-format diffs, and closing only after exact local and GitHub Actions Lint proof.

pdf-large-reader

5
from vamseeachanta/workspace-hub

Memory-efficient PDF processing library for large files exceeding 100MB and 1000 pages

bash-cli-framework-5-error-handling

5
from vamseeachanta/workspace-hub

Sub-skill of bash-cli-framework: 5. Error Handling (+1).

clean-code-git-plumbing-for-repos-with-large-pack-files

5
from vamseeachanta/workspace-hub

Sub-skill of clean-code: Git Plumbing for Repos with Large Pack Files (+1).

instrument-data-allotrope-calculated-data-handling

5
from vamseeachanta/workspace-hub

Sub-skill of instrument-data-allotrope: Calculated Data Handling.

n8n-4-conditional-branching-and-error-handling

5
from vamseeachanta/workspace-hub

Sub-skill of n8n: 4. Conditional Branching and Error Handling.

activepieces-8-error-handling-and-retry-logic

5
from vamseeachanta/workspace-hub

Sub-skill of activepieces: 8. Error Handling and Retry Logic.

highcharts-boost-module-large-datasets

5
from vamseeachanta/workspace-hub

Sub-skill of highcharts: Boost Module (Large Datasets) (+2).