---
title: A month of hours
description: Bookkeeper totals October's hours per client from the timesheet in the workspace, and saves the summary to Drive as a Google Sheet.
agents: [Bookkeeper]
tools: [files.search, workspace.open, workspace.write, workspace.bash, files.save]
source: [packages/agents/src/tools/workspace.ts, packages/agents/src/tools/writes.ts]
---

> Roadstar docs for agents. Every page, as markdown: https://docs.roadstar.app/llms.txt

## What Sam said

In Bookkeeper's chat:

> Can you total October's hours per client from the timesheet? I need it for invoicing.

The chat starts a thread, "October hours".

## 1. Bring the timesheet into the workspace

```json title="use_tool"
{ "name": "files.search", "input": { "query": "Timesheet 2026" } }
```

The timesheet is a Google Sheet. `open` copies it into `/work/inbox` as .xlsx:

```json title="use_tool"
{ "name": "workspace.open", "input": { "files": ["7c41e2d0:1TsTimesheet2026SheetX4"] } }
```

```json
{ "opened": [{ "path": "/work/inbox/Timesheet 2026.xlsx", "from": "7c41e2d0:1TsTimesheet2026SheetX4" }] }
```

## 2. Total it with code

```json title="use_tool"
{
  "name": "workspace.write",
  "input": {
    "path": "october.py",
    "content": "import pandas as pd\n\nhours = pd.read_excel('/work/inbox/Timesheet 2026.xlsx', sheet_name='Log')\noctober = hours[(hours['Date'] >= '2026-10-01') & (hours['Date'] < '2026-11-01')]\nby_client = october.groupby('Client', as_index=False)['Hours'].sum().sort_values('Hours', ascending=False)\nby_client.to_excel('october-hours.xlsx', index=False)\nprint(by_client.to_string(index=False))\nprint('Total', by_client['Hours'].sum())\n"
  }
}
```

```json title="use_tool"
{ "name": "workspace.bash", "input": { "command": "python october.py" } }
```

The run's output:

```text
         Client  Hours
  Juniper Dental   46.5
    Ortiz Bakery   31.0
 Harbor Florists   12.5
Total 90.0
```

Code in the workspace has no internet and changes nothing of Sam's, so none of this needs a yes.

## 3. Save it to Drive

`files.save` puts a workspace file in Drive. `asGoogle` turns the .xlsx into a Google Sheet:

```json title="use_tool"
{
  "name": "files.save",
  "input": {
    "workspace": "october-hours.xlsx",
    "name": "October 2026 hours by client",
    "asGoogle": true,
    "folderId": "7c41e2d0:1FoBookkeeping2026"
  }
}
```

A new file needs no yes. With `over`, the same call would write a new version of the Drive file it was opened from, and that is checked.

## 4. It answers

> October: 90 hours across three clients. Juniper Dental 46.5, Ortiz Bakery 31, Harbor Florists 12.5. The sheet is in Bookkeeping 2026 in Drive.

## Related

- [Workspace](/tools/workspace/), [Files](/tools/files/)
- [Finding and using tools](/how-it-works/tools/#tools-from-code): calling tools from code
