Skip to main content
Glama

unpivot_weekly_csv

Stream-unpivot wide CSVs with weekly columns into tall CSVs one row at a time, avoiding Power Query out-of-memory errors. Optionally keep only rows in a chosen scope.

Instructions

Stream-unpivot a WIDE CSV (one column per week, e.g. '23/06/2024_SALES','23/06/2024_VOLUME') into a TALL CSV (keys + WeekKey + one column per measure), one row at a time. USE THIS when a CSV has hundreds of period columns and Power Query's Table.UnpivotOtherColumns runs the mashup OUT OF MEMORY on big files - the tall CSV then loads with Csv.Document() and no transform. Optional 2-pass scope filter keeps only rows whose scopeColumn value appears for filterColumn=filterValue (e.g. 'the categories the supplier sells in'). Empty weeks are skipped.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
inCsvYesabsolute path to the wide source .csv
outCsvNooutput .csv path (omit to write '<name> (long).csv' next to source)
measuresYesmeasures as suffix:outName, comma-separated, e.g. "_SALES:Sales,_VOLUME:Volume"
keyColumnsYescomma-separated key columns to keep, e.g. "PRODUCT_CODE,STORE_CODE"
filterValueNooptional filter value to keep (the value within the filter column)
scopeColumnNooptional scope column to keep in-scope rows, e.g. "National Merchandise Category"
filterColumnNooptional filter column for the scope pass, e.g. "Supplier Name"
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It reveals key behaviors such as streaming ('one row at a time'), skipping empty weeks, and an optional 2-pass scope filter. These details go beyond the schema and explain edge cases, though it could be more explicit about file handling or error conditions.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is moderately long but every sentence contributes value: it front-loads the core action, then the use case, then the optional filter behavior. No fluff or redundant repetition of schema details is present, though a slightly shorter version could still be equally effective.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given there is no output schema, the description compensates by explicitly defining the output structure ('keys + WeekKey + one column per measure') and covering the key operational behaviors (skipping empty weeks, optional filter). It adequately covers the tool's complexity with 7 parameters, though it omits error-handling or extreme edge cases, keeping it just below a 5.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so parameters are already documented, but the description adds contextual semantics with examples like '23/06/2024_SALES' and explains how keyColumns and measures interact to form the tall CSV structure. This helps an agent understand the intended domain usage beyond the raw parameter descriptions.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's function with a specific verb and resource: 'Stream-unpivot a WIDE CSV ... into a TALL CSV ... one row at a time.' It distinguishes itself from the sibling unpivot tools by explicitly calling out a memory-constrained scenario where Power Query's Table.UnpivotOtherColumns fails, making the unique value proposition clear.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description gives explicit guidance on when to use this tool: 'USE THIS when a CSV has hundreds of period columns and Power Query's Table.UnpivotOtherColumns runs the mashup OUT OF MEMORY on big files.' It also names the alternative (Table.UnpivotOtherColumns) and specifies the streaming benefit, providing clear usage context with no ambiguity.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/cyphonica/powerbi-pbix-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server