8sheets
v1.12.0Excel files for AI agents: open, read, fill, calculate and save xlsx, with no Excel or LibreOffice.
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
open_workbook Open a workbook
Opens an Excel or CSV file (.xlsx, .xlsm, .xlsb, .xls, .csv) and calculates it. Returns its id and its sheets. Paths are absolute or relative to /tmp/mcpkg-smoke.
| Parameter | Type | Description |
|---|---|---|
path * | string | The file |
new_workbook New workbook
Makes an empty workbook with one sheet. save_workbook writes it to a file.
read_range Read cells
Reads the cells of a range as rows of values, with formulas when asked. Without a range, the used cells. At most 10000 cells in one call; "truncated" says when there are more rows.
| Parameter | Type | Description |
|---|---|---|
workbook * | string | The id open_workbook or new_workbook returned |
formulas | boolean | Also return the formulas (null for cells without one) |
range | string | A1 form, such as B2:F40 or A:C |
sheet | string | Sheet name; the active sheet when left out |
set_cells Write cells
Writes rows of values from a cell down and right, then calculates. Text that starts with = is a formula in Excel's English form (=SUM(A1:A9)); null empties a cell; start other text that begins with = with an apostrophe. Returns the cells as calculated and any formula errors in the workbook.
| Parameter | Type | Description |
|---|---|---|
rows * | array | Rows of cell values |
start * | string | The top-left cell, such as B2 |
workbook * | string | The id open_workbook or new_workbook returned |
sheet | string | Sheet name; the active sheet when left out |
add_sheet Add a sheet
Adds a sheet at the end.
| Parameter | Type | Description |
|---|---|---|
name * | string | |
workbook * | string | The id open_workbook or new_workbook returned |
format_cells Format cells
Formats a range: number format, font, fill, alignment, borders. What isn't given stays. Number formats are Excel's, such as #,##0.00, 0.0%, yyyy-mm-dd or #,##0 "zł".
| Parameter | Type | Description |
|---|---|---|
range * | string | A1 form, such as A1:F1 |
workbook * | string | The id open_workbook or new_workbook returned |
align | string | |
bold | boolean | |
border | string | Thin lines: around every cell, around the range, at its top or bottom; none takes them away |
borderColor | string | #RRGGBB |
color | string | #RRGGBB |
fill | string | #RRGGBB |
fontName | string | |
fontSize | number | |
indent | integer | |
italic | boolean | |
merge | boolean | true merges the range into one cell, false parts it again |
numberFormat | string | |
sheet | string | Sheet name; the active sheet when left out |
underline | boolean | |
verticalAlign | string | |
wrap | boolean |
set_sizes Set column widths and row heights
Sets column widths in characters, as Excel shows them, or fits columns to their cells when no width is given; sets row heights in points.
| Parameter | Type | Description |
|---|---|---|
workbook * | string | The id open_workbook or new_workbook returned |
columns | string | Such as A:F or C; every used column when nothing is given |
height | number | In points, such as 24 |
rows | string | Such as 1 or 1:3 |
sheet | string | Sheet name; the active sheet when left out |
width | number | In characters, such as 14; fitted to the cells when left out |
add_table Make a table
Makes an Excel table of a range with a heading row: banded rows, filter buttons, a name for formulas such as =SUM(Sales[Amount]), and a totals row when asked.
| Parameter | Type | Description |
|---|---|---|
range * | string | The cells with their headings, such as A1:E200 |
workbook * | string | The id open_workbook or new_workbook returned |
name | string | Such as Sales |
sheet | string | Sheet name; the active sheet when left out |
style | string | Such as TableStyleMedium2 (the default), TableStyleLight9 or TableStyleDark1 |
totalsRow | boolean | Adds a totals row that sums the last column |
add_conditional_format Add a conditional format
Colors cells by what they hold. Comparison rules take value (and value2 for between): a number, text, or a formula that starts with =. formula takes one for the range's first cell, such as =$F2="Overdue". top and bottom take how many. Color scales and data bars take colors, icons an icon set.
| Parameter | Type | Description |
|---|---|---|
range * | string | Such as D2:D200 |
rule * | string | |
workbook * | string | The id open_workbook or new_workbook returned |
bold | boolean | |
color | string | #RRGGBB |
colors | array | Two or three for a color scale, from the lowest value to the highest; one for a data bar |
fill | string | #RRGGBB |
icons | string | |
sheet | string | Sheet name; the active sheet when left out |
value | number | string | |
value2 | number | string |
set_sheet Change a sheet
Renames a sheet, freezes rows and columns, shows or hides gridlines, colors the tab, and sets up the page for printing and PDF.
| Parameter | Type | Description |
|---|---|---|
workbook * | string | The id open_workbook or new_workbook returned |
fitToWidth | boolean | Prints all columns on one page across |
freezeColumns | integer | |
freezeRows | integer | Rows that stay when scrolling, such as 1; 0 for none |
gridlines | boolean | |
landscape | boolean | |
name | string | |
sheet | string | Sheet name; the active sheet when left out |
tabColor | string | #RRGGBB |
add_chart Add a chart
Adds a chart of a range to a sheet. The first row and column of the range name the series and the categories when they hold text. The chart is an Excel chart that follows its cells.
| Parameter | Type | Description |
|---|---|---|
data * | string | The data with its headings, such as A1:D13, or Data!A1:D13 of another sheet |
type * | string | |
workbook * | string | The id open_workbook or new_workbook returned |
cell | string | The cell its top-left corner stands on, such as G2; a free place beside the cells when left out |
height | number | Height in points, 216 when left out |
sheet | string | The sheet the chart goes on; the active sheet when left out |
title | string | The chart title; Excel's automatic one when left out |
width | number | Width in points, 360 when left out |
add_pivot_table Add a PivotTable
Adds a PivotTable that sums up a table or a range with a heading row, and returns its cells. Put it on a sheet of its own or where nothing is in its way. It stays a live PivotTable in Excel.
| Parameter | Type | Description |
|---|---|---|
cell * | string | Its top-left cell, such as A3 |
source * | string | A table's name, or a range with headings such as Data!A1:E500 |
values * | array | What is summed up |
workbook * | string | The id open_workbook or new_workbook returned |
columns | array | Headings whose values become columns |
filters | array | Headings to filter by, above the table |
rows | array | Headings whose values become rows, outermost first |
sheet | string | The sheet it goes on; the active sheet when left out |
add_slicer Add a slicer or a timeline
Adds a box of buttons that filters a PivotTable (with every other one of the same source) or a table by one of its fields, or a timeline for a field of dates of a PivotTable. People click it in Excel; filter_slicer sets it.
| Parameter | Type | Description |
|---|---|---|
cell * | string | The cell its top-left corner is on, such as H2 |
field * | string | A heading of its data |
source * | string | The name of the PivotTable or table |
workbook * | string | The id open_workbook or new_workbook returned |
caption | string | |
columns | integer | Columns of buttons |
height | number | In points |
kind | string | slicer when left out |
level | string | The periods of a timeline |
width | number | In points |
filter_slicer Filter with a slicer or a timeline
Sets what a slicer selects, or the days a timeline keeps, and filters the PivotTables or the table it is connected to. Nothing given clears the filter.
| Parameter | Type | Description |
|---|---|---|
name * | string | The name of the slicer or timeline, as open_workbook lists it |
workbook * | string | The id open_workbook or new_workbook returned |
from | string | The first day a timeline keeps, as YYYY-MM-DD |
selected | array | The items of a slicer to show |
to | string | The last day it keeps |
refresh_pivot_tables Refresh PivotTables
Reads the sources of the workbook's PivotTables again, as Refresh All does in Excel. Do it after changing cells they read.
| Parameter | Type | Description |
|---|---|---|
workbook * | string | The id open_workbook or new_workbook returned |
find_errors Find formula errors
Lists the formulas whose result is an error (#REF!, #DIV/0! and so on), at most 100.
| Parameter | Type | Description |
|---|---|---|
workbook * | string | The id open_workbook or new_workbook returned |
save_workbook Save as xlsx
Saves the workbook as .xlsx (.xlsm when it was opened with macros). Charts, pictures, macros and other parts of the file it came from are kept. An existing file is replaced only with overwrite: true.
| Parameter | Type | Description |
|---|---|---|
workbook * | string | The id open_workbook or new_workbook returned |
overwrite | boolean | |
path | string | Where to save; the file it was opened from when left out |
save_pdf Save as PDF
Writes a sheet, or every sheet that isn't hidden, as a PDF with its charts, shapes, slicers and pictures, on the paper and with the page setup of the workbook (see set_sheet). An existing file is replaced only with overwrite: true.
| Parameter | Type | Description |
|---|---|---|
path * | string | Such as report.pdf |
workbook * | string | The id open_workbook or new_workbook returned |
archive | boolean | Write an archive file, PDF/A-2b, with all fonts embedded |
overwrite | boolean | |
sheet | string | One sheet; every sheet when left out |
close_workbook Close a workbook
Closes a workbook. Changes that weren't saved are lost.
| Parameter | Type | Description |
|---|---|---|
workbook * | string | The id open_workbook or new_workbook returned |