8sheets

v1.12.0
com.8sheets/mcp Checked 13 hours ago Published 1 day ago

Excel 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.

ParameterTypeDescription
path *stringThe 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.

ParameterTypeDescription
workbook *stringThe id open_workbook or new_workbook returned
formulasbooleanAlso return the formulas (null for cells without one)
rangestringA1 form, such as B2:F40 or A:C
sheetstringSheet 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.

ParameterTypeDescription
rows *arrayRows of cell values
start *stringThe top-left cell, such as B2
workbook *stringThe id open_workbook or new_workbook returned
sheetstringSheet name; the active sheet when left out

add_sheet Add a sheet

Adds a sheet at the end.

ParameterTypeDescription
name *string
workbook *stringThe 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ł".

ParameterTypeDescription
range *stringA1 form, such as A1:F1
workbook *stringThe id open_workbook or new_workbook returned
alignstring
boldboolean
borderstringThin lines: around every cell, around the range, at its top or bottom; none takes them away
borderColorstring#RRGGBB
colorstring#RRGGBB
fillstring#RRGGBB
fontNamestring
fontSizenumber
indentinteger
italicboolean
mergebooleantrue merges the range into one cell, false parts it again
numberFormatstring
sheetstringSheet name; the active sheet when left out
underlineboolean
verticalAlignstring
wrapboolean

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.

ParameterTypeDescription
workbook *stringThe id open_workbook or new_workbook returned
columnsstringSuch as A:F or C; every used column when nothing is given
heightnumberIn points, such as 24
rowsstringSuch as 1 or 1:3
sheetstringSheet name; the active sheet when left out
widthnumberIn 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.

ParameterTypeDescription
range *stringThe cells with their headings, such as A1:E200
workbook *stringThe id open_workbook or new_workbook returned
namestringSuch as Sales
sheetstringSheet name; the active sheet when left out
stylestringSuch as TableStyleMedium2 (the default), TableStyleLight9 or TableStyleDark1
totalsRowbooleanAdds 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.

ParameterTypeDescription
range *stringSuch as D2:D200
rule *string
workbook *stringThe id open_workbook or new_workbook returned
boldboolean
colorstring#RRGGBB
colorsarrayTwo or three for a color scale, from the lowest value to the highest; one for a data bar
fillstring#RRGGBB
iconsstring
sheetstringSheet name; the active sheet when left out
valuenumber | string
value2number | 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.

ParameterTypeDescription
workbook *stringThe id open_workbook or new_workbook returned
fitToWidthbooleanPrints all columns on one page across
freezeColumnsinteger
freezeRowsintegerRows that stay when scrolling, such as 1; 0 for none
gridlinesboolean
landscapeboolean
namestring
sheetstringSheet name; the active sheet when left out
tabColorstring#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.

ParameterTypeDescription
data *stringThe data with its headings, such as A1:D13, or Data!A1:D13 of another sheet
type *string
workbook *stringThe id open_workbook or new_workbook returned
cellstringThe cell its top-left corner stands on, such as G2; a free place beside the cells when left out
heightnumberHeight in points, 216 when left out
sheetstringThe sheet the chart goes on; the active sheet when left out
titlestringThe chart title; Excel's automatic one when left out
widthnumberWidth 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.

ParameterTypeDescription
cell *stringIts top-left cell, such as A3
source *stringA table's name, or a range with headings such as Data!A1:E500
values *arrayWhat is summed up
workbook *stringThe id open_workbook or new_workbook returned
columnsarrayHeadings whose values become columns
filtersarrayHeadings to filter by, above the table
rowsarrayHeadings whose values become rows, outermost first
sheetstringThe 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.

ParameterTypeDescription
cell *stringThe cell its top-left corner is on, such as H2
field *stringA heading of its data
source *stringThe name of the PivotTable or table
workbook *stringThe id open_workbook or new_workbook returned
captionstring
columnsintegerColumns of buttons
heightnumberIn points
kindstringslicer when left out
levelstringThe periods of a timeline
widthnumberIn 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.

ParameterTypeDescription
name *stringThe name of the slicer or timeline, as open_workbook lists it
workbook *stringThe id open_workbook or new_workbook returned
fromstringThe first day a timeline keeps, as YYYY-MM-DD
selectedarrayThe items of a slicer to show
tostringThe 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.

ParameterTypeDescription
workbook *stringThe 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.

ParameterTypeDescription
workbook *stringThe 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.

ParameterTypeDescription
workbook *stringThe id open_workbook or new_workbook returned
overwriteboolean
pathstringWhere 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.

ParameterTypeDescription
path *stringSuch as report.pdf
workbook *stringThe id open_workbook or new_workbook returned
archivebooleanWrite an archive file, PDF/A-2b, with all fonts embedded
overwriteboolean
sheetstringOne sheet; every sheet when left out

close_workbook Close a workbook

Closes a workbook. Changes that weren't saved are lost.

ParameterTypeDescription
workbook *stringThe id open_workbook or new_workbook returned