Using Windows as example, have a REPL (e.g. Powershell, C#/F# interactive) that interacts with the OS via COM/UWP, DLLs, OLE Automation.
So you can from the confort of your REPL get the text selected in e.g. Excel, and use it as input for a function that was actually imported from a DLL for data conversions, for example.