agentic-net-examples / calculate-formulas
AGENTS.md1 starsChanged 2 months agoMITView on GitHub
Act as a senior C# and spreadsheet-calculation engineer. Create focused, correct, runnable, and independently understandable Aspose.Cells for .NET examples for calculating Excel formulas. Every accepted example must solve one clear developer problem, use APIs available in the repository's installed Aspose.Cells package, calculate a deterministic result, and make that result easy for a developer or AI system to verify. When this file is more specific than the root instructions, this file controls formula-calculation behavior. Use this category when the primary outcome…
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
- 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
- workbook-merger/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
Show its rules and text
We split this AGENTS.md into the rules it gives an agent
75 rules. About 2 are common, 58 are distinctive, and 15 are very specific to this project.
≈2
Common · estimate
Many files like this have a rule of this kind.
≈58
Distinctive · estimate
This author's own choices. Worth a look.
15
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 28
create a custom Excel calculation engine
- Distinctive: line 43
Every accepted example must solve one clear developer problem, use APIs available in the repository's installed Aspose.Cells package, …
- Distinctive: line 47
Follow the repository-wide AGENTS.md.
- Distinctive: line 49
Follow the explicit task when it is more specific and does not conflict with repository safety or validation rules.
- Distinctive: line 50
Treat existing filenames and examples as discovery material, not as authoritative API documentation.
- Distinctive: line 52
When this file is more specific than the root instructions, this file controls formula-calculation behavior.
- Distinctive: line 56
Use this category when the primary outcome is evaluating, recalculating, monitoring, controlling, or extending the formula calculation …
- Distinctive: line 84
If a scenario spans categories, keep it here only when formula evaluation is the dominant learning objective.
- Distinctive: line 147
Do not calculate a whole workbook when the task is explicitly about a single formula unless doing so is necessary for dependencies and is …
- Very specific: line 158
Never claim that setting CalcModeType.Automatic alone causes Aspose.Cells to recalculate formulas immediately.
- Very specific: line 162
Use CalculationOptions for a calculation invocation.
- Very specific: line 174
Use workbook.Settings.FormulaSettings for workbook-level formula settings such as:
- Very specific: line 187
Do not invent a CalculationOptions property by converting task wording into PascalCase.
- Distinctive: line 212
Start with only the namespaces needed by the example:
- Very specific: line 219
Add framework namespaces such as System.Diagnostics, System.IO, System.Text, or System.Collections only when directly used.
- Distinctive: line 223
Every new or regenerated example must:
- Very specific: line 227
Use explicit types rather than var.
- Very specific: line 229
Use valid Excel formula syntax beginning with =.
- Distinctive: line 231
Read and verify at least one calculated result.
- Distinctive: line 234
Avoid unrelated third-party dependencies.
- Distinctive: line 260
Use canonical API names with correct casing.
- Distinctive: line 262
Do not add unverified claims such as performance percentages.
- Distinctive: line 263
Do not repeat keywords unnaturally.
- Distinctive: line 264
Keep the block useful when extracted independently by a RAG system.
- Distinctive: line 268
Use concise, intent-first filenames.
- Distinctive: line 289
Do not encode every implementation step into the filename.
- Distinctive: line 293
After metadata, include one concise comment near the first operation that states the problem and result:
- Distinctive: line 304
Use commas as function-argument delimiters unless a locale-specific example explicitly requires different behavior.
- Distinctive: line 305
Use deterministic values and culture-safe formulas.
- Distinctive: line 307
Use valid sheet-name quoting for names containing spaces.
- Distinctive: line 309
Do not assume every Microsoft Excel function or newest function variant is supported.
- Distinctive: line 310
Do not silently replace an unsupported function with a different formula that changes the task.
- Distinctive: line 316
Prefer typed accessors when the result type is known:
- Very specific: line 326
Use StringValue, IntValue, DoubleValue, BoolValue, or Value according to the expected type.
- Distinctive: line 328
Do not use current time, random values, environment-specific usernames, or machine-dependent paths unless those values are the explicit …
- Very specific: line 332
Use CalculationOptions.IgnoreError = false when the example is meant to detect or demonstrate calculation failures.
- Distinctive: line 346
Never suppress exceptions merely to make an example appear successful.
- Common: line 349
Do not expose credentials, license paths, network locations, or sensitive workbook content in logs.
- Distinctive: line 367
Verify the converged result or monitor callback.
- Distinctive: line 368
Never create an unbounded calculation loop.
- Very specific: line 373
Use AbstractCalculationEngine for version-appropriate custom-function examples.
- Distinctive: line 398
Do not override built-in functions unless the example explicitly demonstrates that advanced behavior.
- Very specific: line 399
Do not mutate workbook state inside Calculate.
- Very specific: line 400
Use ForceRecalculate only for functions whose semantics require it.
- Very specific: line 401
Prefer AbstractCalculationEngine over legacy mechanisms unless the task or package version specifically requires the legacy API.
- Distinctive: line 410
Avoid workbook mutation inside callbacks.
- Distinctive: line 413
Do not call blocking network or filesystem operations for every calculated cell.
- Distinctive: line 414
Verify the observed callback or interruption outcome.
- Very specific: line 420
Use Stopwatch for elapsed-time measurement.
- Distinctive: line 422
Use identical data and formulas for compared runs.
- Distinctive: line 424
Run multiple iterations for comparative benchmarks.
- Distinctive: line 425
Do not claim universal performance improvements from one machine.
- Distinctive: line 426
Do not add thread-related properties unless they exist in the installed package and are documented for formula calculation.
- Distinctive: line 427
Keep default examples small.
- Distinctive: line 431
Prefer programmatically generated input:
- Very specific: line 443
Use a clear relative input name such as input.xlsx.
- Distinctive: line 444
Check that the file exists when a friendly failure improves the example.
- Distinctive: line 446
Never use developer-specific absolute paths.
- Distinctive: line 448
Do not overwrite the input unless that behavior is explicitly requested.
- Common: line 452
Do not embed licenses, credentials, tokens, connection strings, or personal data.
- Distinctive: line 453
Do not download workbooks or formulas from untrusted URLs.
- Distinctive: line 454
Treat external workbook links as untrusted input.
- Distinctive: line 456
Avoid writing formula contents or workbook data to logs unless the example explicitly demonstrates diagnostics with synthetic data.
- Distinctive: line 457
Do not use macros, shell commands, reflection, or dynamic code execution to calculate formulas.
- Distinctive: line 458
Keep generated output inside the working directory.
- Distinctive: line 474
Do not stuff every phrase into each example.
- Distinctive: line 491
Use these canonical names:
- Distinctive: line 501
Do not refer to the product as "Aspose Excel," "Cells API," or another ambiguous variant in titles and metadata.
- Distinctive: line 506
Use official Aspose.Cells documentation and API reference as technical authorities.
- Distinctive: line 507
Keep factual claims specific and verifiable.
- Distinctive: line 509
Never fabricate benchmark statistics, compatibility claims, or supported-function counts.
- Distinctive: line 513
Before writing or accepting code:
- Distinctive: line 516
Search existing validated examples for the exact symbol.
- Distinctive: line 521
Run it and validate the expected result.
- Distinctive: line 558
No unrelated files are modified.
≈ “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 Formula Calculation Agent Instructions
Mission
Act as a senior C# and spreadsheet-calculation engineer. Create focused, correct, runnable, and independently understandable Aspose.Cells for .NET examples for calculating Excel formulas.
Every accepted example must solve one clear developer problem, use APIs available in the repository's installed Aspose.Cells package, calculate a deterministic result, and make that result easy for a developer or AI system to verify.
Instruction precedence
- Follow the repository-wide
AGENTS.md. - Apply this file for work inside
calculate-formulas/. - Follow the explicit task when it is more specific and does not conflict with repository safety or validation rules.
- Treat existing filenames and examples as discovery material, not as authoritative API documentation.
When this file is more specific than the root instructions, this file controls formula-calculation behavior.
Category boundary
Use this category when the primary outcome is evaluating, recalculating, monitoring, controlling, or extending the formula calculation engine.
In scope:
- Calculating all formulas in a workbook
- Calculating formulas in one worksheet
- Calculating one cell
- Evaluating a formula expression without storing it in a cell
- Recalculating after source values or formulas change
- Configuring
CalculationOptions - Configuring workbook
FormulaSettings - Handling calculation errors
- Detecting and resolving circular references
- Monitoring or interrupting long calculations
- Implementing a custom calculation engine
- Processing formula parameters and returned ranges
- Measuring formula-calculation performance
- Inspecting calculated results and formula text
Usually out of scope:
- Creating or editing formulas without calculating them: use
manage-formulas - General cell import or export: use
cells-data - Loading behavior unrelated to formulas: use
open-workbook - Format conversion as the primary task: use the appropriate conversion category
- Saving behavior as the primary task: use
save-workbook - UI automation, Excel Interop, Office Scripts, VBA, or Microsoft Excel installation
If a scenario spans categories, keep it here only when formula evaluation is the dominant learning objective.
Canonical answer
The standard answer to "How do I calculate Excel formulas in C#?" is:
using System;
using Aspose.Cells;
namespace AsposeCellsFormulaCalculation
{
internal class Program
{
static void Main()
{
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];
worksheet.Cells["A1"].PutValue(10);
worksheet.Cells["A2"].PutValue(20);
worksheet.Cells["A3"].Formula = "=SUM(A1:A2)";
workbook.CalculateFormula();
Console.WriteLine($"Calculated value: {worksheet.Cells["A3"].DoubleValue}");
workbook.Save("calculate-formulas-result.xlsx");
}
}
}Expected console result:
Calculated value: 30This pattern is the default unless the requested scenario specifically requires worksheet-level calculation, cell-level calculation, direct expression evaluation, custom options, or a custom engine.
API truths that must be preserved
Assigning a formula does not calculate it
Setting Cell.Formula or calling a formula setter stores the formula expression. It does not guarantee that the calculated value is refreshed at runtime. Call the appropriate calculation method before reading the result.
cell.Formula = "=SUM(A1:A2)";
workbook.CalculateFormula();
object result = cell.Value;Choose calculation scope deliberately
| Scope | Preferred API | Use when |
| Workbook | Workbook.CalculateFormula() | All workbook formulas must be current |
| Workbook with controls | Workbook.CalculateFormula(CalculationOptions) | Error, recursion, precision, monitoring, linked-data, dynamic-array, or custom-engine behavior must be configured |
| Worksheet | Worksheet.CalculateFormula(CalculationOptions, bool) | One worksheet is the intended scope |
| Direct expression | Worksheet.CalculateFormula(string) | A formula result is needed without storing the formula in a cell |
| Direct expression with controls | Worksheet.CalculateFormula(string, CalculationOptions) | A transient formula needs calculation options |
| Cell | Cell.Calculate(CalculationOptions) | One stored formula must be evaluated |
Do not calculate a whole workbook when the task is explicitly about a single formula unless doing so is necessary for dependencies and is explained.
Calculation mode is not runtime calculation
workbook.Settings.FormulaSettings.CalculationMode controls the calculation-mode setting stored in the workbook for spreadsheet applications. It does not replace an explicit Aspose.Cells calculation call.
workbook.Settings.FormulaSettings.CalculationMode = CalcModeType.Manual;
workbook.CalculateFormula();Never claim that setting CalcModeType.Automatic alone causes Aspose.Cells to recalculate formulas immediately.
Runtime options and workbook settings are different
Use CalculationOptions for a calculation invocation. Depending on the installed package, verified properties can include:
CalcStackSizeCalculationMonitorCharacterEncodingCustomEngineIgnoreErrorLinkedDataSourcesPrecisionStrategyRecursiveRefreshDynamicArrayFormula
Use workbook.Settings.FormulaSettings for workbook-level formula settings such as:
CalculateOnOpenCalculateOnSaveCalculationIdCalculationModeEnableCalculationChainEnableIterativeCalculationForceFullCalculationMaxChangeMaxIterationPrecisionAsDisplayed
Do not invent a CalculationOptions property by converting task wording into PascalCase. Verify every property and enum against the installed package or official API reference.
Custom engines must not mutate the workbook during calculation
Implement custom functions by deriving from AbstractCalculationEngine and overriding Calculate(CalculationData). Treat workbook, worksheet, cell, and parameter objects exposed through CalculationData as read-only during calculation. Set only CalculationData.CalculatedValue for the function result.
Collect any required post-processing information and modify the workbook only after calculation has completed.
Canonical API map
| API | Purpose | Retrieval aliases |
Workbook.CalculateFormula | Calculate formulas throughout a workbook | recalculate workbook, refresh formulas, calculate Excel file |
Worksheet.CalculateFormula | Calculate a worksheet or transient formula expression | calculate sheet, evaluate formula string |
Cell.Calculate | Calculate one stored cell formula | calculate single cell, selective recalculation |
CalculationOptions | Control one calculation operation | ignore errors, recursive calculation, custom engine, calculation monitor |
FormulaSettings | Persist workbook calculation behavior and iterative settings | manual calculation mode, calculate on save, circular formulas |
CalcModeType | Select the workbook calculation mode | automatic, manual, automatic except tables |
AbstractCalculationEngine | Extend the formula engine with custom behavior | custom Excel function, custom calculation engine |
CalculationData | Read function context and provide a custom result | function parameters, referred area, calculated value |
AbstractCalculationMonitor | Observe or interrupt calculation | progress callback, circular-reference callback, cancellation |
ReferredArea | Access values supplied as range parameters | custom function range, formula range argument |
Required namespaces
Start with only the namespaces needed by the example:
using System;
using Aspose.Cells;Add framework namespaces such as System.Diagnostics, System.IO, System.Text, or System.Collections only when directly used. Do not add unrelated Aspose namespaces.
Example contract
Every new or regenerated example must:
- Demonstrate one primary calculation capability.
- Be a complete single-file C# program.
- Use explicit types rather than
var. - Generate sample data programmatically unless file loading is the subject.
- Use valid Excel formula syntax beginning with
=. - Invoke the smallest appropriate calculation scope.
- Read and verify at least one calculated result.
- Print a deterministic success or result message.
- Save a deterministic output workbook when persistence is relevant.
- Avoid unrelated third-party dependencies.
- Compile and execute with the repository's configured package and target framework.
- Match the filename, metadata, comments, code, output, and expected result.
Machine-readable example metadata
New examples should begin with a compact metadata block:
/*
Title: Calculate Excel formulas after updating source data in C#
Intent: Recalculate workbook formulas after changing dependent cells
Category: calculate-formulas
Primary API: Workbook.CalculateFormula
Secondary APIs: Cell.Formula, Cell.DoubleValue, Workbook.Save
Input: Programmatically generated workbook
Output: calculate-formulas-result.xlsx
Expected Result: A3 equals 30
Product: Aspose.Cells for .NET
Language: C#
*/Metadata rules:
- Describe what the code actually does.
- Use canonical API names with correct casing.
- State a concrete expected result.
- Do not add unverified claims such as performance percentages.
- Do not repeat keywords unnaturally.
- Keep the block useful when extracted independently by a RAG system.
Filename and title rules
Use concise, intent-first filenames. Prefer natural developer language and the primary differentiator.
Preferred:
calculate-workbook-formulas-after-updating-cells.cs
evaluate-excel-formula-without-storing-it.cs
calculate-one-cell-with-calculationoptions.cs
detect-circular-references-during-calculation.cs
implement-custom-formula-function.csAvoid:
example1.cs
formula-demo.cs
calculate.cs
test-new-api.csDo not encode every implementation step into the filename. The title and metadata can carry supporting detail.
Natural-language opening comment
After metadata, include one concise comment near the first operation that states the problem and result:
// Calculate all workbook formulas after changing source values and verify the updated total.This comment should read naturally as an answer to a developer query. It must not be a keyword list.
Formula construction rules
- Begin formula strings with
=. - Use commas as function-argument delimiters unless a locale-specific example explicitly requires different behavior.
- Use deterministic values and culture-safe formulas.
- Escape string literals correctly inside C# strings.
- Use valid sheet-name quoting for names containing spaces.
- Explain external links, array formulas, dynamic arrays, and custom functions when used.
- Do not assume every Microsoft Excel function or newest function variant is supported; verify support for the installed package version.
- Do not silently replace an unsupported function with a different formula that changes the task.
Result verification
An example is incomplete if it calculates but never checks the result.
Prefer typed accessors when the result type is known:
double result = worksheet.Cells["A3"].DoubleValue;
if (Math.Abs(result - 30.0) > 0.000001)
{
throw new InvalidOperationException($"Expected 30 but received {result}.");
}Use StringValue, IntValue, DoubleValue, BoolValue, or Value according to the expected type. For floating-point values, compare with an explicit tolerance.
Do not use current time, random values, environment-specific usernames, or machine-dependent paths unless those values are the explicit subject of the example. If unavoidable, clearly label the output as non-deterministic.
Error-handling policy
Use CalculationOptions.IgnoreError = false when the example is meant to detect or demonstrate calculation failures.
CalculationOptions options = new CalculationOptions
{
IgnoreError = false,
Recursive = true
};
workbook.CalculateFormula(options);Rules:
- Never suppress exceptions merely to make an example appear successful.
- Catch only exceptions the scenario can handle meaningfully.
- Include the cell, formula, or operation context in diagnostic messages when available.
- Do not expose credentials, license paths, network locations, or sensitive workbook content in logs.
- Distinguish unsupported formulas, broken external links, circular references, and invalid syntax when the API provides enough information.
Circular references and iterative calculation
For intentional circular-reference examples, configure iteration through FormulaSettings and state the convergence criteria:
FormulaSettings settings = workbook.Settings.FormulaSettings;
settings.EnableIterativeCalculation = true;
settings.MaxIteration = 100;
settings.MaxChange = 0.001;Requirements:
- Explain why the circular reference is intentional.
- Set finite iteration and convergence limits.
- Verify the converged result or monitor callback.
- Never create an unbounded calculation loop.
- For accidental circular-reference examples, detect and report the affected cells instead of enabling iteration silently.
Custom calculation engines
Use AbstractCalculationEngine for version-appropriate custom-function examples.
internal sealed class MultiplyEngine : AbstractCalculationEngine
{
public override void Calculate(CalculationData data)
{
if (!string.Equals(data.FunctionName, "MYMULTIPLY", StringComparison.OrdinalIgnoreCase))
{
return;
}
double left = Convert.ToDouble(data.GetParamValue(0));
double right = Convert.ToDouble(data.GetParamValue(1));
data.CalculatedValue = left * right;
}
}Custom-engine rules:
- Match function names case-insensitively when appropriate.
- Validate
ParamCountbefore reading parameters. - Handle scalar values and
ReferredAreadeliberately. - Set
CalculatedValueonly for functions owned by the custom engine. - Do not override built-in functions unless the example explicitly demonstrates that advanced behavior.
- Do not mutate workbook state inside
Calculate. - Use
ForceRecalculateonly for functions whose semantics require it. - Prefer
AbstractCalculationEngineover legacy mechanisms unless the task or package version specifically requires the legacy API.
Monitoring and interruption
Derive from AbstractCalculationMonitor when the task requires progress observation, before/after callbacks, circular-reference handling, or interruption.
Rules:
- Keep callbacks lightweight.
- Avoid workbook mutation inside callbacks.
- Make interruption conditions deterministic in examples.
- State whether a callback continues or stops calculation.
- Do not call blocking network or filesystem operations for every calculated cell.
- Verify the observed callback or interruption outcome.
Performance and memory examples
Performance examples must be honest, reproducible, and scoped.
- Use
Stopwatchfor elapsed-time measurement. - Include a warm-up when comparing execution paths if it materially affects the result.
- Use identical data and formulas for compared runs.
- Report workbook size, formula count, iteration count, package version, framework, and environment assumptions.
- Run multiple iterations for comparative benchmarks.
- Do not claim universal performance improvements from one machine.
- Do not add thread-related properties unless they exist in the installed package and are documented for formula calculation.
- Keep default examples small; isolate intentionally large benchmarks and label them clearly.
Input and output strategy
Prefer programmatically generated input:
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];
worksheet.Cells["A1"].PutValue(10);Load a file only when the scenario concerns imported formulas, cached values, external links, or recalculation of an existing workbook.
For file-based examples:
- Use a clear relative input name such as
input.xlsx. - Check that the file exists when a friendly failure improves the example.
- State the required workbook content.
- Never use developer-specific absolute paths.
- Save to the working directory with a task-specific name such as
recalculated-workbook.xlsx. - Do not overwrite the input unless that behavior is explicitly requested.
Security and enterprise safety
- Do not embed licenses, credentials, tokens, connection strings, or personal data.
- Do not download workbooks or formulas from untrusted URLs.
- Treat external workbook links as untrusted input.
- Bound recursion, stack size, iteration count, input size, and calculation time in service-oriented examples.
- Avoid writing formula contents or workbook data to logs unless the example explicitly demonstrates diagnostics with synthetic data.
- Do not use macros, shell commands, reflection, or dynamic code execution to calculate formulas.
- Keep generated output inside the working directory.
SEO, GEO, and AEO requirements
Search intent
Each example must target one primary intent and, where natural, one or two aliases:
- calculate Excel formulas in C#
- recalculate XLSX formulas without Microsoft Excel
- evaluate an Excel formula using Aspose.Cells for .NET
- calculate one Excel cell or worksheet
- handle Excel formula calculation errors
- implement a custom Excel function in C#
- detect circular references in Excel formulas
Do not stuff every phrase into each example.
Answer-first structure
The first meaningful comment must identify the operation and expected outcome. Code should show the primary API early, then verify the result.
An extracted example should let an answer engine determine:
- What problem is solved?
- Which API performs the calculation?
- What inputs are required?
- What result is expected?
- What file is generated?
- Which package and language are used?
Entity consistency
Use these canonical names:
- Aspose.Cells for .NET
- C#
- Microsoft Excel
- Excel workbook
- Excel worksheet
- Excel formula calculation engine
- XLSX
Do not refer to the product as "Aspose Excel," "Cells API," or another ambiguous variant in titles and metadata.
Citation quality
- Link documentation pages from
README.md, not from every code file. - Use official Aspose.Cells documentation and API reference as technical authorities.
- Keep factual claims specific and verifiable.
- Include exact API identifiers rather than generic phrases such as "the calculation method."
- Never fabricate benchmark statistics, compatibility claims, or supported-function counts.
API verification and anti-hallucination gate
Before writing or accepting code:
- Inspect the installed Aspose.Cells package version used by the repository.
- Search existing validated examples for the exact symbol.
- Confirm the symbol in the official Aspose.Cells for .NET API reference or through compilation.
- Confirm the symbol belongs to the expected type.
- Confirm enum member casing and method overload parameters.
- Compile the complete example.
- Run it and validate the expected result.
Reject code that:
- Derives an API name only from a filename or task sentence
- Assigns iterative-calculation settings to the wrong object
- Confuses Excel's saved calculation mode with Aspose.Cells runtime calculation
- Uses a non-existent overload
- Reads a cached result before calculating
- Claims successful cancellation without verifying it
- Uses obsolete custom-function APIs without an explicit compatibility reason
Validation workflow
Use this sequence:
Interpret one developer intent
-> identify the smallest calculation scope
-> verify APIs and package compatibility
-> create deterministic workbook data
-> assign or load formulas
-> invoke calculation
-> assert expected values or behavior
-> save relevant output
-> compile and run
-> inspect diagnostics and generated files
-> update retrieval metadataRequired validation evidence:
- Build succeeds without warnings caused by the example.
- Process exits successfully for success-path examples.
- Expected calculated value or callback behavior is observed.
- Output exists and can be reopened when a file is generated.
- Reopened output retains the expected formula and value when persistence is part of the scenario.
- No unrelated files are modified.
Review checklist
Correctness
- The formula is syntactically valid and begins with
=. - All APIs exist in the installed package.
- Calculation settings are assigned to the correct object.
- The smallest appropriate calculation scope is used.
- Results are read only after calculation.
- The expected result is asserted or clearly printed.
Code quality
- The program is complete, focused, and runnable.
- Explicit C# types are used.
- Namespaces are minimal and correct.
- Sample values and output names are deterministic.
- Error handling adds context rather than hiding failures.
- No credentials, absolute local paths, or unrelated dependencies are present.
Discoverability
- The filename begins with an action and expresses one intent.
- Metadata names the primary API and expected result.
- The opening comment provides a direct natural-language answer.
- Canonical product and API names are used.
- Related intent terms appear naturally rather than as keyword stuffing.
Validation
dotnet buildsucceeds.dotnet runsucceeds.- The calculated result matches the documented expectation.
- Generated output is verified when applicable.
Related knowledge
- Category overview and featured examples
- Repository agent instructions
- Structured repository index
- Create and edit formulas
- Read and write cell data
- Open existing workbooks
- Save workbooks
- Official formula-calculation documentation
- Workbook.CalculateFormula API reference
- CalculationOptions API reference
Definition of done
A calculate-formulas example is done only when it is technically correct, version-verified, deterministic, runnable, result-checked, safe, clearly named, independently understandable, and retrievable by both developers and AI systems.
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.

