What to Build After Deploying a Local LLM: Connecting On-Premise Models to Spreadsheets
This article explains what teams can actually do once a local LLM is deployed, and why the missing piece is usually a business entry point rather than compute. It covers the four-layer architecture (spreadsheet, macro script, middleware service, inference runtime), how to choose a model size based on available memory, the key details of calling the model from spreadsheet macros (escaping, key management, synchronous blocking, stream parsing), and practical upgrades such as batch processing, structured output, RAG, concurrency limits, and logging. A troubleshooting list and additional use cases are included.
1. Where the Real Value Appears After Local Deployment
Many teams finish setting up a local inference environment and then have no idea what to do next. The reason is usually not a lack of compute, but the absence of a “business entry point.” A model by itself is only an inference service that can be called; it produces real returns only once it is embedded into an existing workflow.
The core value of local deployment comes down to three points:
- Controlled data boundary: Sensitive text such as contracts, medical records, financial statements, and customer lists never has to travel over an external network, which makes compliance review and internal audits easier to pass.
- Predictable cost structure: Inference resources are a fixed investment, and higher call volume generates no additional billing. This suits high-frequency, short-context batch scenarios.
- Customizable and offline-capable: You can swap the tokenization strategy, add domain-specific corpus data, and run stably in environments with no external network access.
Among all possible entry points, the spreadsheet is one of the most underrated. A large share of text-processing needs inside companies end up in a state where someone opens a spreadsheet and pastes and tidies up text row by row. Wiring a local model into spreadsheet cells puts intelligent capability directly in the hands of business users.
2. Overall Architecture: Four Layers
A workable solution usually has four layers, with clear boundaries of responsibility:
- Interaction layer: The spreadsheet, responsible for question entry and holding results.
- Script layer: Macro scripts inside the spreadsheet, responsible for sending requests, parsing responses, and writing values back to cells.
- Service layer: A middleware service responsible for session management, knowledge base mounting, key validation, and forwarding requests to the inference engine.
- Inference layer: The local model runtime, responsible for loading weights, executing inference, and emitting streaming results.
There are three practical reasons to introduce a service layer instead of letting the spreadsheet connect directly to the inference engine: inference engine APIs are typically designed for single-shot generation and lack multi-turn sessions and access control; keys should not be hardcoded in office documents; and the service layer can enforce rate limiting and logging in one place, which makes later troubleshooting easier.
3. Environment Setup and Model Selection
Inference runtime: Install a local model runtime. It exposes an HTTP interface in a commonly used style on the local machine and listens on the loopback address by default. After installation, pull a model from the command line and run one minimal call to verify that the port is reachable.
Choosing a model size: This is the most frequently overlooked step. The following ranges are a practical reference:
| Memory / VRAM | Suggested parameter scale | Suitable scenarios |
|---|---|---|
| Under 8GB | 1.5B–3B | Short text rewriting, classification |
| Around 16GB | 7B–8B | General Q&A, summarization |
| 32GB or more | 14B and above | Complex reasoning, long-document analysis |
Quantized versions cut memory usage significantly, at the cost of slightly reduced stability in long chains of reasoning. If the spreadsheet task is extraction, categorization, or rewriting with short outputs, a quantized model is entirely sufficient.
Middleware service: Deploy a knowledge base service with an admin interface. Its role is to package the “model” into an “assistant with context.” Three things need to be done: create a workspace, mount local documents as a retrieval source, and in the settings enter the inference runtime’s endpoint and model name, then generate an access key. Note that the workspace identifier usually must be lowercase.
4. Script Layer Implementation Details
Open the spreadsheet’s macro editor (Alt + F11 in common desktop versions) and insert a new module. The code below is illustrative: it shows the structure of request construction and response handling rather than being a finished piece you can copy directly.
Sub AskLocalModel()Dim q As String, body As String, resp As StringDim http As Objectq = ThisWorkbook.Sheets(1).Range("A2").ValueIf Len(Trim(q)) = 0 Then Exit SubSet http = CreateObject("MSXML2.XMLHTTP")http.Open "POST", "http://localhost:3001/api/v1/workspace/demo/stream-chat", Falsehttp.setRequestHeader "Content-Type", "application/json"http.setRequestHeader "Authorization", "Bearer " & ENV_KEY ' read from an environment variablehttp.send "{""message"":""" & Replace(q, """", "'") & """,""mode"":""chat""}"If http.Status = 200 Thenresp = http.responseTextThisWorkbook.Sheets(1).Range("A4").Value = ExtractText(resp)ElseThisWorkbook.Sheets(1).Range("A4").Value = "Call failed: " & http.StatusEnd IfEnd Sub
Four details determine whether the script works reliably:
- Escaping: If a question contains double quotes or line breaks, direct concatenation breaks the JSON structure, so you must replace them first or switch to JSON serialization.
- Key management: Do not put the key in the code. Read it from an environment variable or a separate configuration sheet so it is not leaked when the document is shared externally.
- Synchronous blocking:
Falsemeans a synchronous wait, and long text generation will freeze the spreadsheet UI. You can switch to asynchronous calls with polling, or move time-consuming tasks into a separate batch script. - Stream parsing: With streaming output enabled, the response is line-delimited event data. You need to strip the prefix from each line, concatenate the incremental fragments, and then extract the final text. If you would rather not handle streaming, choose non-streaming mode on the server side, at the cost of a longer time to first token.
5. From “Working” to “Usable”
Batch processing: Change the single-row call into a loop over a range, turn off UI refresh with Application.ScreenUpdating = False, and write a checkpoint every few rows so a mid-way failure does not force everything to be redone.
Structured output: Do not let the model improvise. Specify the output format in the prompt (for example, “output JSON only, with fields category and reason”), then validate once on the script side and retry once if parsing fails. This is the most critical engineering constraint when connecting generative capability to a business system.
Retrieval augmentation: When a question must be answered based on internal policies or product manuals, put the documents into the knowledge base service and let the service layer retrieve first and then assemble the context. This uses fewer resources than stuffing long documents into the prompt and is easier to keep updated.
Concurrency and rate limiting: Local inference throughput is limited, so batch tasks should cap concurrency (usually 1–2 streams are enough to saturate a single GPU) and the service layer should set up a queue to prevent request pileup from repeated clicks on the spreadsheet side.
Observability: Log the latency, input length, and failure reason for every call. A local model service without logs is nearly impossible to diagnose when something goes wrong.
6. Troubleshooting Common Issues
- Connection refused on the request: confirm the runtime port is listening and that the address entered in the service layer was not set to an external address.
- 401 returned: the key does not match, or the workspace identifier has the wrong case.
- Garbled text in the result cell: usually the response was not decoded correctly as UTF-8, or streaming fragments were concatenated out of order.
- Truncated output: the context window is full, so shorten the prompt or switch to a model with a larger window.
- Spreadsheet unresponsive for a long time: the synchronous call is blocking; switch to asynchronous or split the task.
7. Extended Scenarios
With minor adjustments, the same architecture covers more needs: drafting batches of product descriptions, turning unstructured feedback into spreadsheet fields, writing weekly reports automatically from a template, classifying tickets by intent and priority, and converting meeting notes into to-do lists. If multiple people need to collaborate, the interaction layer can move from a local spreadsheet to a self-hosted form or page service on the internal network, while the service layer and inference layer are reused entirely.
In environments with strict data compliance requirements, the whole chain can be deployed on a container platform, with object storage holding knowledge base documents, a logging service collecting call records, and monitoring alerts setting thresholds on inference latency. This keeps the advantage of data never leaving the internal network while turning operations from “manual restarts” into something observable and recoverable.
Local deployment is only the starting point. The real dividing line is whether model capability can be embedded into a concrete business process. Start with a spreadsheet and fill in the engineering pieces — calling, parsing, validation, retry, and logging — and a private AI assistant has truly landed.
