# Security Questionnaire Automation With OneDrive

A fleet software company drafts each prospect's security questionnaire from the approved answers its security lead keeps in OneDrive, then a person reviews it.

[Run this on Rush](https://cloud.getrush.ai/run/answer-each-security-questionnaire/onedrive/). Opens the console with this prompt ready to send. Connect OneDrive there first.

## What the agent does

This is for a software company that sells fleet tracking and dispatch software to trucking firms and delivery networks. Before a large shipper signs, its procurement team sends a security questionnaire: usually an Excel workbook of questions about access control, encryption, backups, incident response and the vendors the company relies on, with a column for each answer. The company's security lead has answered nearly all of these before and keeps the approved answers in a workbook in OneDrive, but every shipper words the questions its own way, and the workbook lands on a sales rep's desk with a deadline. The company wants a first draft inside the prospect's own workbook on the day it arrives, so the security lead's time goes to the questions that are actually new.

The member who owns the sales tooling connects the company's Microsoft account once with `POST /me/connections {"type": "app", "name": "onedrive"}` from their API key, and opens the `authorize_url` while signed in to the Rush console. Rush's OneDrive product asks Microsoft for `Files.ReadWrite.All` and signs each Microsoft Graph call from outside the sandbox, so the agent never holds a token. A key's run gets only the connections it names, so every request carries `"connections": ["onedrive"]`. The folder layout is the company's own: `Security Reviews/Incoming` for workbooks as they arrive, `Answer Library.xlsx` with an ID, a question, the approved answer, its owner and the date it was last reviewed, `Completed` for questionnaires already returned, and `Drafts` for what the agent writes.

A run downloads the new workbook with `GET /me/drive/root:/Security Reviews/Incoming/<file name>:/content`, the answer library the same way, and lists `Completed` with `GET /me/drive/root:/Security Reviews/Completed:/children`, following `@odata.nextLink`, since Microsoft's reference pages a folder at 200 items by default. It opens each workbook with a spreadsheet library on its own computer and finds, from the header row of every sheet, which column holds the question, which takes the answer, and whether the answer cell is a fixed list such as Yes, No or N/A with a comment column beside it.

For each question it looks for the library entry that answers the same thing, whatever the wording, and writes that approved answer unchanged. Where the cell takes a fixed list, it picks the value the approved answer supports and puts the approved text in the comment column. It leaves the answer empty and flags the row when no entry matches, when the entry is older than the review date in the prompt, when a returned questionnaire in `Completed` said something different, or when the question asks for a document such as a policy or a test report. It saves a copy with an added sheet named Rush review that lists every flagged row, uploads it to `Drafts` with `PUT /me/drive/root:/Security Reviews/Drafts/<file name>:/content`, and never touches the original or writes an answer the library does not hold.

## Start it with one API call

`POST https://api.phoenix.so/o/{org}/sessions`

```json
{
  "agent": "claude",
  "input": "Draft answers for the security questionnaire 'Northline Freight - Vendor Security Review 2026.xlsx' in OneDrive. Download it with GET /me/drive/root:/Security Reviews/Incoming/Northline Freight - Vendor Security Review 2026.xlsx:/content and the library with GET /me/drive/root:/Security Reviews/Answer Library.xlsx:/content (columns: ID, Question, Approved answer, Owner, Last reviewed). List GET /me/drive/root:/Security Reviews/Completed:/children, following @odata.nextLink, and read the five most recently modified workbooks for comparison only. In every sheet of the questionnaire, find the question and answer columns from the header row. For each question, find the library entry that answers the same thing and write its approved answer unchanged; where the answer cell takes a fixed list such as Yes, No or N/A, choose the value the approved answer supports and put the approved text in the comment column if there is one. Leave the answer empty and flag the row when no entry matches, the entry was last reviewed before 2025-11-28, a completed questionnaire answered it differently, or the question asks for a document. Never write an answer that is not in the library. Add a sheet named Rush review listing each flagged row (sheet, row, question, reason, library ID) and upload the copy with PUT /me/drive/root:/Security Reviews/Drafts/Northline Freight - Vendor Security Review 2026 - DRAFT.xlsx:/content. Do not change, move or delete any other file. Return only JSON: {draft_url, questions, answered, flagged: [{sheet, row, reason}]}.",
  "connections": [
    "onedrive"
  ]
}
```

1. **Get an API key.** In the console, open Settings, then API keys, and create a key for your org. Send it in the Authorization header as a Bearer token.
2. **Send the request.** POST the body in request.json to https://api.phoenix.so/o/{org}/sessions. The run starts in its own cloud sandbox.
3. **Read what came back.** Follow the run on its live stream or wait for the run.completed webhook, then read the result and its trajectory.

## What comes back

A copy of the prospect's workbook lands in Drafts with approved answers filled in and a Rush review sheet listing each row left for a person. The run's answer gives the draft's address and how many questions were answered and flagged, which the sales tooling posts to the deal.

The security lead opens the Rush review sheet first. Flagged rows are the work: new questions, answers due for review, and requests for documents. Then a spot check of the matched rows, because matching by meaning can pair two neighbouring questions, such as backup frequency and recovery time, that need different answers; and of every Yes or No the agent chose, since procurement teams read those first. Opening the draft beside the original in Excel also shows whether protection, macros or merged cells in the prospect's workbook came through the copy.

The draft is only as current as the library it was written from. When the security lead writes a new answer for a flagged row, adding it to `Answer Library.xlsx` with its review date means the next questionnaire that asks the same thing is drafted without a flag. The rep sends the reviewed workbook to the prospect; the agent never emails anyone.

## Run it on every security questionnaire from a prospect

The company's intake form for security reviews saves the prospect's workbook to `Security Reviews/Incoming` and its handler sends this request with the file name in `input` and a `request_id` that is a UUID v5 of the OneDrive item id, so a form submitted twice starts one run. The key's `run.completed` webhook carries the result back, and the handler posts the draft's address and the flag count to the deal's channel for the security lead.

Questionnaires bunch up at the end of a quarter. Each one is its own run with its own computer, and runs past the key's `max_concurrent` wait as `queued` until one finishes, so each workbook in a Friday pile gets its own draft.

## Why run it on Rush?

The Microsoft sign-in stays in Rush's connection, and each Graph call is signed outside the sandbox, so no token sits on a rep's laptop or in a script. `Files.ReadWrite.All` reaches the whole drive; the prompt confines writing to one new file in `Drafts`, and the transcript records every download and upload, which is the record a security team will want of a tool that reads its approved answers.

A script that matches questions by exact text fails on the first shipper that rephrases them, and most do. The agent reads for meaning, on its own computer with whatever spreadsheet library the workbook needs, and leaves a record of each step and the run's cost. What it leaves for the security lead is the flagged rows, not the copying.

## Frequently asked questions

### Does the agent decide what our security answers are?

No. It copies approved answers from the library and leaves everything else empty and flagged. Your security lead writes new answers, and adding them to the library is what lets later drafts use them.

### What about questionnaires that come as a web portal instead of a workbook?

This request works on workbooks. Many portals export their questions to a spreadsheet; save that export to `Incoming` and the same run drafts it, and a person enters the reviewed answers in the portal.

### Why does Rush ask for access to the whole OneDrive?

Rush's OneDrive product names one scope, `Files.ReadWrite.All`, so the same connection serves jobs that read and write files anywhere. This prompt writes a single new file in `Drafts`, and the transcript shows each Graph call the run made.

### Will it keep the prospect's formatting?

It edits a copy and changes only answer and comment cells, plus the added review sheet. Workbooks with protection, macros or unusual validation can lose some of that in any library, so compare the draft with the original before it goes back.

## More OneDrive jobs

- [Which Subcontractors Haven't Sent Their Lien Waivers This Month? Construction Software That Checks Each Contractor's OneDrive Before Payday](https://getrush.ai/run/check-each-pay-application-for-lien-waivers/onedrive/)
- [Which Supplier Prices Went Up This Month? A Field-Service App's Check of Each HVAC Contractor's OneDrive Price Lists](https://getrush.ai/run/compare-supplier-price-lists/onedrive/)
- [Read Supplier Invoice PDFs From Each Customer's OneDrive Into Draft Bills](https://getrush.ai/run/extract-supplier-invoices/onedrive/)

## More jobs like this: Produce a report or file, no repo

- [List Every API Endpoint in an ASP.NET Core App](https://getrush.ai/run/api-endpoint-inventory/aspnet-core/)
- [Inventory Every API Endpoint of an Axum Service](https://getrush.ai/run/api-endpoint-inventory/axum/)
- [List Every API Endpoint in an Express App](https://getrush.ai/run/api-endpoint-inventory/express/)

## Keep reading

- [Connect OneDrive to Rush once, then name it on any run](https://getrush.ai/integrations/onedrive/)
- [Start your first run from the developer API quickstart](https://getrush.ai/docs/quickstart/)
- [Rush pricing: Free, Pro and Max](https://getrush.ai/pricing/)
