SheetXL - v0.3.20
    Preparing search index...

    Interface IScript

    Contains interfaces for working with scripts.

    Scripts are collections of modules that contain functions.

    Modules are analogous to files, and functions are the executable code within those modules.

    interface IScript {
        addModule(uid: string, module: IModule, options?: AddOptions): void;
        createModule(options?: CompileOptions): Promise<IModule>;
        executeMacro(
            functionName: string,
            moduleId?: string,
        ): Promise<MacroResults>;
        getModules(): IModuleCollection;
        searchFunction(options?: SearchFunctionsOptions): IFunction[];
        start(): Promise<void>;
        toJSON(): Record<string, IModule.JSON>;
    }
    Index

    Methods

    • Adds a module to the script.

      Parameters

      • uid: string
      • module: IModule
      • Optionaloptions: AddOptions

      Returns void

    • Creates a module from the source code.

      Parameters

      • Optionaloptions: CompileOptions

      Returns Promise<IModule>

    • Executes a macro function.

      Parameters

      • functionName: string

        The name of the function to execute.

      • OptionalmoduleId: string

        The ID of the module containing the function.

      Returns Promise<MacroResults>

    • Returns a collection of modules.

      Returns IModuleCollection

    • Convenience method for creating a module from a file.

      Parameters

      • Optionaloptions: SearchFunctionsOptions

      Returns IFunction[]

      equivalent to getModules().search( { type: 'macro', name } )

    • Will start scripting engine and autoRun scripts.

      Returns Promise<void>

    • Returns a JSON representation of the script.

      Returns Record<string, IModule.JSON>