Drive storage

Let your app save to the buyer's own Google Drive or OneDrive. No servers, no sign-in code, no keys to look after. Back to the .

How it works

The buyer connects their drive once. After that, every app they own that uses storage can ask to use it, and the buyer says yes to each one.

  • Your app gets its own folder: Winning Arc/<your app>/.
  • Shared files, like the Business File, live in Winning Arc/Shared/. Several apps can use them. Files you define for your own apps go in Winning Arc/Shared/<your name>/.
  • Your code never sees a password or key. It calls our storage library and we do the rest.
  • The same code works on Google Drive and OneDrive.

Declare it

Add a storage block to manifest.json. Your app's Drive tab in the studio writes it for you. Apps without this block can't use storage at all.

"storage": {
  "providers": ["google", "microsoft"],
  "ownFolder": true,
  "sharedFiles": [{ "name": "business-file", "access": "read-write", "minVersion": 1 }],
  "purpose": "Saves your clients, rates and invoice history to your own drive."
}
  • providers: "google", "microsoft" or both.
  • ownFolder: true if your app keeps its own files.
  • sharedFiles: shared files from the , with "read" or "read-write" and the lowest version you need.
  • makerFiles (optional): shared files you define for your own apps. See .
  • purpose: one plain sentence. Buyers see it on your app page and before they say yes.

We turn down uploads that name a shared file or version that doesn't exist.

The nine calls

Paths are inside your app's folder, like "invoices/INV-12.pdf". For a shared file, use its name, like "business-file".

CallWhat it does
status()Which drives are connected, which one this app uses, and what it may do. If nothing is connected, a link to connect.
createFile(path, kind, template?)Makes a sheet, document or empty file in your app's folder. Gives back a file handle.
listFiles(prefix?)Lists your app's files: path, kind and when each was last changed.
readTable(file, tab, range?)Reads a tab. Gives back headers, rows and a version.
appendRows(file, tab, rows)Adds rows at the end of a tab.
updateRows(file, tab, match, values, ifVersion?)Changes rows matched on the ID column. Only the columns you name change.
writeFile(path, bytes, mime)Saves a PDF, CSV, PNG, JPEG or WebP file, up to 10 MB.
readFile(file)Opens a file. Gives back its bytes and type.
nextNumber(file, counter)Takes the next number, like an invoice number. Two chats never get the same one.

Code examples

The library is already installed where your code runs. TypeScript:

import { storage, StorageError } from "@winningarc/storage";

export default async function handler(inputs: { client: string }: any) {
  try {
    const clients = await storage.readTable("business-file", "Clients");
    const n = await storage.nextNumber("business-file", "invoice");
    await storage.appendRows("business-file", "Invoices", [
      { Number: n.text, "Client ID": inputs.client, Status: "Draft" },
    ]);
    return { number: n.text, clients: clients.total };
  } catch (e) {
    if (e instanceof StorageError && e.code === "not_connected") return { connect: e.connectUrl };
    throw e;
  }
}

Python:

from winningarc import storage, StorageError

def handler(inputs):
    try:
        clients = storage.readTable("business-file", "Clients")
        n = storage.nextNumber("business-file", "invoice")
        storage.appendRows("business-file", "Invoices", [
            {"Number": n["text"], "Client ID": inputs["client"], "Status": "Draft"}
        ])
        return {"number": n["text"], "clients": clients["total"]}
    except StorageError as e:
        if e.code == "not_connected":
            return {"connect": e.connect_url}
        raise

Your handler can call storage as many times as it needs, up to 50 calls in one run.

Apps without code

If your app is steps only (a SKILL.md), the buyer's AI gets a tool called <your app>-drive with the same nine calls. Tell it in your steps what to read and save, for example: "Call status first. Then read the Clients tab of business-file."

Errors

Every error has a code and a short message you can show as it is.

CodeWhat to do
not_connectedNo drive yet. Show the buyer the connect link that comes with it.
not_grantedThe buyer hasn't approved this app, or you asked for something you didn't declare.
conflictThe tab changed since you read it, or the ID is already used. Read again, then retry.
limit_reachedToo big or too many calls. Wait a minute, or send less.
provider_errorGoogle or Microsoft didn't answer. Try again in a moment.
bad_requestSomething in the call is wrong, like a path with "..". The message says what.

Limits

  • Files up to 10 MB.
  • Up to 120 calls a minute for each buyer, and 50 in one run.
  • Read up to 5,000 rows, and add or change up to 500 rows, in one call.
  • Apps hosted on your own server can't use drive storage.

Test drive

Before you send a version for checking, try it on your own drive.

  1. Upload the version in the studio.
  2. On the Versions tab, press Test drive.
  3. In your own Claude or ChatGPT with Winning Arc connected, use <your app>-test. It works for 24 hours.
  4. Connect a test Google or OneDrive account when it asks.

Rules

  • Never copy, collect or send a buyer's drive data outside your app.
  • Use only what you declared. Calls outside it are refused and we see them.
  • Match rows by ID, never by name. Never delete rows the buyer added.
  • The buyer can edit their files by hand. Check what you read, and ask them about anything odd instead of writing over it.

The full rules are in the .