agentic-net-examples / workbook-merger
AGENTS.md1 starsChanged 2 months agoMITView on GitHub
Create correct, runnable C# examples for combining complete workbooks or copying selected worksheets between workbooks. Follow ../AGENTS.md, then this guide. Generated examples are discovery candidates only. In scope: Workbook.Combine, selected-sheet Worksheet.Copy, multiple-source consolidation, preservation checks for cells/formulas/styles/drawings, and file or stream output. Out of scope: appending relational rows into one table, ordinary same-workbook sheet management, formula-engine tutorials, format conversion, and protection as the primary goal. Use explicit types, generated sources by default, unique valid sheet names, expected counts/names/cells, a deterministic…
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.
Of the AGENTS.md files we read, the 11,773 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository32 other files it gives its agents.
- Aspose.Cells for .NET Product AgentAGENTS.md
- calculate-formulas/AGENTS.mdAGENTS.md
- cells-data/AGENTS.mdAGENTS.md
- comments-and-notes/AGENTS.mdAGENTS.md
- conversion/AGENTS.mdAGENTS.md
- document-properties/AGENTS.mdAGENTS.md
- encryption-and-protection/AGENTS.mdAGENTS.md
- format-cells/AGENTS.mdAGENTS.md
- globalization-and-localization/AGENTS.mdAGENTS.md
- macro-project/AGENTS.mdAGENTS.md
- manage-formulas/AGENTS.mdAGENTS.md
- manage-workbook/AGENTS.mdAGENTS.md
- managing-ranges/AGENTS.mdAGENTS.md
- open-workbook/AGENTS.mdAGENTS.md
- pivot-table/AGENTS.mdAGENTS.md
- queries-and-connections/AGENTS.mdAGENTS.md
- rows-and-columns/AGENTS.mdAGENTS.md
- save-workbook/AGENTS.mdAGENTS.md
- slicer/AGENTS.mdAGENTS.md
- smart-markers/AGENTS.mdAGENTS.md
- sparkline/AGENTS.mdAGENTS.md
- timeline/AGENTS.mdAGENTS.md
- working-with-charts/AGENTS.mdAGENTS.md
- working-with-html/AGENTS.mdAGENTS.md
- working-with-images/AGENTS.mdAGENTS.md
- working-with-json/AGENTS.mdAGENTS.md
- working-with-pdf/AGENTS.mdAGENTS.md
- working-with-shapes/AGENTS.mdAGENTS.md
- working-with-tables/AGENTS.mdAGENTS.md
- working-with-worksheets/AGENTS.mdAGENTS.md
- xml-maps/AGENTS.mdAGENTS.md
- llms.txtllms.txt
The file
We split this AGENTS.md into the rules it gives an agent
3 rules. About 0 are common, 0 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 22
Create correct, runnable C# examples for combining complete workbooks or copying selected worksheets between workbooks.
- Very specific: line 79
Use explicit types, generated sources by default, unique valid sheet names, expected counts/names/cells, a deterministic output, and …
- Very specific: line 85
Use Combine for whole workbooks and Worksheet.Copy for selected sheets.
≈ “Common” is an estimate: at least 1 in 5 of the 16,595 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Aspose.Cells Workbook Merger Agent Instructions
Mission and boundary
Create correct, runnable C# examples for combining complete workbooks or copying selected worksheets between workbooks. Follow ../AGENTS.md, then this guide. Generated examples are discovery candidates only.
In scope: Workbook.Combine, selected-sheet Worksheet.Copy, multiple-source consolidation, preservation checks for cells/formulas/styles/drawings, and file or stream output.
Out of scope: appending relational rows into one table, ordinary same-workbook sheet management, formula-engine tutorials, format conversion, and protection as the primary goal.
Canonical answer
using System;
using Aspose.Cells;
Workbook destination = new Workbook();
Worksheet north = destination.Worksheets[0];
north.Name = "North";
north.Cells["A1"].PutValue("North revenue");
north.Cells["B1"].PutValue(1250);
Workbook source = new Workbook();
Worksheet south = source.Worksheets[0];
south.Name = "South";
south.Cells["A1"].PutValue("South revenue");
south.Cells["B1"].PutValue(1750);
destination.Combine(source);
if (destination.Worksheets.Count != 2 ||
destination.Worksheets["South"].Cells["B1"].IntValue != 1750)
{
throw new InvalidOperationException("Workbook merge validation failed.");
}
destination.Save("merged-workbooks.xlsx", SaveFormat.Xlsx);
Console.WriteLine("Created merged-workbooks.xlsx with 2 worksheets.");API truths and map
| Goal | API |
| Append complete source workbook | Workbook.Combine |
| Copy selected source worksheet | Worksheet.Copy |
| Create copy destination | WorksheetCollection.Add |
| Recalculate results | Workbook.CalculateFormula |
| Persist merge | Workbook.Save |
Combinemutates the destination. Account for its initial default sheet.- For selected cross-workbook copy, add a destination worksheet and call
target.Copy(source). Worksheets.AddCopycopies within the same workbook; do not present it as the cross-workbook API.- Structural workbook merge is not relational row consolidation.
- Resolve worksheet and defined-name collisions deterministically.
- Validate formulas, external links, styles, charts, images, VBA, and chosen output format after save/reload; never promise universal losslessness.
- Calculate formulas explicitly when current results are required.
- Preserve macros only with a compatible format and verified behavior.
Contract, validation, and safety
Use explicit types, generated sources by default, unique valid sheet names, expected counts/names/cells, a deterministic output, and metadata describing the merge. Validate before save and preferably after reopen. Check formulas and values separately; check drawing counts and render when fidelity matters.
Reject path traversal and unsupported formats, avoid overwriting inputs, limit source count/size, reset output stream position for consumers, and do not log sensitive workbook data. Avoid legacy merge helpers as the default unless explicitly required and verified.
AI retrieval and FAQ
Use Combine for whole workbooks and Worksheet.Copy for selected sheets. A blank destination can produce an unwanted blank tab; start from the intended first workbook or handle the default sheet. Use streams for in-memory output. Benchmark large merges instead of claiming constant memory.
Official resources
Definition of done
The example compiles, runs, merges the intended workbook content, validates exact sheet/data state and round-trip output, and does not overwrite or silently lose source content.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

