Skip to content

Commit 5f50df8

Browse files
FabianFabian
Fabian
authored and
Fabian
committed
2 parents 77c1c43 + 563892c commit 5f50df8

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

README.md

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# ExcelScript
2+
Roslyn-based Excel AddIn that allows to write, compile, and run C# code right in Excel using simple user-defined functions
3+
4+
Aside from doing simple immediate evaluations, some of the core features are:
5+
6+
- You can create re-usable scripts on the fly in your worksheets, which will be stored in an in-memory cache with a used-defined string key.
7+
- You can then invoke that script using its key anywhere as often as you like
8+
- You can define and pass parameters to your scripts, so they can be invoked with arguments
9+
- Range-objects are fully supported as input parameters (ExcelScript takes care of converting & marshalling these internally)
10+
- You can create the parameter definitions & script manually, or just parse a function and have the AddIn extract and generate all necessary handles automatically
11+
- You can even register your script, meaning the AddIn will register a User Defined function with the name and all parameters you defined to invoke your script
12+
- A helper function lets you format & syntax highlight your C#-code in Excel
13+
- You can serialize/deserialize your scripts to strings or files
14+
15+
Some bonus features:
16+
17+
- You can debug your scripts. To do so, try the following:
18+
1. Open the addin and the Example.xlsm
19+
2. Attach the debugger of your choice to the Excel.exe process (e.g. open Visual Studio -> Debug -> Attach to Process -> Excel)
20+
3. In any script, e.g. lets say on Sheet "Parse" in cell B18, enter "System.Diagnostics.Debugger.Break();"
21+
4. When this script is run, your debugger should behave as expected; break execution, show the code, show local variables, etc.
22+
- The library supports execution in different AppDomains. By default, a script will run in a shared appdomain between all other scripts; you could also pass in an option to run in a shared appdomain with the main addin (ExcelDna's default domain), or to create a seperate appdomain for that script.
23+
- By default, all functions are marked non-volatile. Unfortunately, that means that after opening a workbook, you need to refresh each formula that creates a script by hand or macro. ExcelScript offers an experimental way around this, though:
24+
1. Open The ExcelScript-AddIn.xll.config
25+
2. set TagDirtyMethodCalls to true
26+
3. This will mark each cell creating a handle (script, parameter and so on) to dirty once. Could be particularly useful in manual calculation mode (in auto calculation mode, all scripts would run on the next recalculation, so not very useful).
27+
28+
Project includes an exemplary Excel-file to demonstrate usage. Please see the Wiki on Github for further guidelines.

0 commit comments

Comments
 (0)