Modules@robinpath/office
office

@robinpath/office

0.1.4Node.jsPublic

Microsoft Office document creation and reading (Word, Excel, PowerPoint) for RobinPath

Office

Enterprise Microsoft Office suite — Word (.docx), Excel (.xlsx), PowerPoint (.pptx) with 57 functions: hyperlinks, TOC, footnotes, comments, sections, headers/footers, doc patching, conditional formatting, data validation, sheet protection, slide masters, and more

Package: @robinpath/office | Category: Documents | Type: Integration

Authentication

No authentication required. All functions are available immediately.

Use Cases

Use the office module when you need to:

  • Create a new Word document -- Use office.createDoc to perform this operation
  • Read text or HTML from an existing Word document -- Use office.readDoc to perform this operation
  • Add a heading with level and formatting -- Use office.addHeading to perform this operation
  • Add a paragraph with rich text formatting -- Use office.addParagraph to perform this operation
  • Add a table with full styling (headers, borders, colors, widths) -- Use office.addTable to perform this operation

Quick Reference

FunctionDescriptionReturns
createDocCreate a new Word documentDocument ID
readDocRead text or HTML from an existing Word documentDocument content as text or HTML
addHeadingAdd a heading with level and formattingtrue
addParagraphAdd a paragraph with rich text formattingtrue
addTableAdd a table with full styling (headers, borders, colors, widths)true
addImageAdd an image to the documenttrue
addPageBreakAdd a page breaktrue
addListAdd a bulleted or numbered listtrue
addHyperlinkAdd a clickable hyperlink to the documenttrue
addBookmarkAdd a named bookmark for cross-referencestrue
addTableOfContentsAdd an auto-generated table of contents from headingstrue
addFootnoteAdd a footnote reference in text with footnote content at bottomFootnote ID
addCommentAdd a comment annotation on a text rangeComment ID
addSectionAdd a new document section with separate formatting (orientation, columns, margins)Section index
setDocPropertiesSet document metadata properties (title, author, keywords)true
addDocStyleDefine a reusable named paragraph or character styletrue
addHeaderAdd a custom header to the current sectiontrue
addFooterAdd a custom footer with optional page numberstrue
patchDocModify an existing .docx by replacing placeholders with new content{path}
addCheckboxAdd a checkbox with label texttrue
saveDocSave the Word document to a .docx file{path, size}
createSheetCreate a new Excel workbookWorkbook ID
readSheetRead data from an existing Excel fileArray of row objects (header row becomes keys)
addRowAdd a row with optional stylingRow number
writeDataWrite array of objects to sheet with auto-headers and stylingNumber of rows written
writeCellWrite a value to a specific cell with formattingtrue
styleRangeApply formatting to a range of cellstrue
addFormulaAdd a formula to a celltrue
setColumnWidthSet column widthstrue
mergeCellsMerge a range of cellstrue
loadSheetLoad an existing Excel file for editingWorkbook ID
addWorksheetAdd a new worksheet to an existing workbookSheet name
freezePanesFreeze header rows and/or columnstrue
setAutoFilterAdd filter dropdowns on header columnstrue
addConditionalFormatAdd conditional formatting rules (color scales, data bars, icon sets, cell rules)true
addDataValidationAdd data validation (dropdowns, number/date constraints) to a celltrue
addCellCommentAdd a comment/note to a celltrue
addSheetImageEmbed an image in a spreadsheettrue
addNamedRangeDefine a named range for formulastrue
protectSheetProtect a worksheet with a password and permission optionstrue
hideRowsColumnsHide or show rows and columnstrue
saveSheetSave the workbook to an .xlsx file{path}
createSlidesCreate a new PowerPoint presentationPresentation ID
addSlideAdd a slide with optional title/subtitle and backgroundSlide index
addSlideTextAdd a text box to a slide with full formattingtrue
addSlideImageAdd an image to a slide with positioningtrue
addSlideTableAdd a data table to a slide with stylingtrue
addSlideChartAdd a chart to a slidetrue
addSlideShapeAdd a shape to a slidetrue
addSlideNotesAdd speaker notes to a slidetrue
addSlideMultiTextAdd rich text with mixed formatting (bold/italic/color) in one text boxtrue
setSlideNumberAdd a slide number to a slidetrue
defineSlideMasterDefine a reusable slide master template with logo, background, and placeholderstrue
addSlideFromMasterCreate a new slide from a defined master templateSlide index
saveSlidesSave the presentation to a .pptx file{path}
setSheetPrintConfigure print layout: paper size, orientation, print area, marginstrue
groupRowsGroup rows (or columns) into collapsible outline groupstrue

Functions

createDoc

Create a new Word document

Module: office | Returns: string -- Document ID

office.createDoc "report" {"margins": {"top": 1, "bottom": 1}} into $doc
ParameterTypeRequiredDescription
idstringNoDocument ID
optionsobjectNo{margins: {top, bottom, left, right}}

readDoc

Read text or HTML from an existing Word document

Module: office | Returns: string -- Document content as text or HTML

office.readDoc "./contract.docx" "text" into $content
ParameterTypeRequiredDescription
filePathstringYesPath to .docx file
formatstringNo'text' (default) or 'html'

addHeading

Add a heading with level and formatting

Module: office | Returns: boolean -- true

office.addHeading $doc "Sales Report" 1 {"color": "#2196F3", "alignment": "center"}
ParameterTypeRequiredDescription
docIdstringYesDocument ID
textstringYesHeading text
levelnumberNoHeading level 1-6
optionsobjectNo{bold, italic, fontSize, font, color, alignment, spacing}

addParagraph

Add a paragraph with rich text formatting

Module: office | Returns: boolean -- true

office.addParagraph $doc "Revenue increased by 23%" {"bold": true, "fontSize": 12, "alignment": "justify", "spacing": {"after": 200}}
ParameterTypeRequiredDescription
docIdstringYesDocument ID
textstringYesParagraph text
optionsobjectNo{bold, italic, underline, fontSize, font, color, alignment, spacing, indent, runs: [{text, bold, color}]}

addTable

Add a table with full styling (headers, borders, colors, widths)

Module: office | Returns: boolean -- true

office.addTable $doc $data {"headerStyle": {"fillColor": "#2196F3", "fontColor": "#FFFFFF"}, "alternateRows": true}
ParameterTypeRequiredDescription
docIdstringYesDocument ID
dataarrayYesArray of objects or array of arrays
optionsobjectNo{headerStyle: {bold, fillColor, fontColor}, cellStyle, columnWidths, borders, alternateRows}

addImage

Add an image to the document

Module: office | Returns: boolean -- true

office.addImage $doc "./chart.png" {"width": 500, "height": 300, "alignment": "center"}
ParameterTypeRequiredDescription
docIdstringYesDocument ID
imagePathstringYesPath to image file
optionsobjectNo{width, height, alignment}

addPageBreak

Add a page break

Module: office | Returns: boolean -- true

office.addPageBreak $doc
ParameterTypeRequiredDescription
docIdstringYesDocument ID

addList

Add a bulleted or numbered list

Module: office | Returns: boolean -- true

office.addList $doc ["Item 1", "Item 2", "Item 3"] {"ordered": true, "fontSize": 11}
ParameterTypeRequiredDescription
docIdstringYesDocument ID
itemsarrayYesArray of strings
optionsobjectNo{ordered: bool, bold, fontSize, font, color}

addHyperlink

Add a clickable hyperlink to the document

Module: office | Returns: boolean -- true

office.addHyperlink $doc "Visit our site" "https://example.com" {"bold": true}
ParameterTypeRequiredDescription
docIdstringYesDocument ID
textstringYesDisplay text
urlstringYesTarget URL
optionsobjectNo{color, bold, fontSize, font, underline, alignment}

addBookmark

Add a named bookmark for cross-references

Module: office | Returns: boolean -- true

office.addBookmark $doc "section1" "Introduction" {"bold": true}
ParameterTypeRequiredDescription
docIdstringYesDocument ID
namestringYesBookmark name
textstringYesBookmark text
optionsobjectNo{bold, fontSize, font, color}

addTableOfContents

Add an auto-generated table of contents from headings

Module: office | Returns: boolean -- true

office.addTableOfContents $doc {"heading": "Contents", "headingRange": "1-3"}
ParameterTypeRequiredDescription
docIdstringYesDocument ID
optionsobjectNo{heading, hyperlink, headingRange: '1-5'}

addFootnote

Add a footnote reference in text with footnote content at bottom

Module: office | Returns: number -- Footnote ID

office.addFootnote $doc "See reference" "Source: IEEE 2024 paper" {}
ParameterTypeRequiredDescription
docIdstringYesDocument ID
textstringYesParagraph text
footnoteTextstringYesFootnote content
optionsobjectNo{bold, fontSize, font, color, alignment}

addComment

Add a comment annotation on a text range

Module: office | Returns: number -- Comment ID

office.addComment $doc "This needs review" "Please verify the figures" {"author": "Editor"}
ParameterTypeRequiredDescription
docIdstringYesDocument ID
textstringYesCommented text
commentTextstringYesComment content
optionsobjectNo{author, bold, fontSize}

addSection

Add a new document section with separate formatting (orientation, columns, margins)

Module: office | Returns: number -- Section index

office.addSection $doc {"orientation": "landscape", "type": "nextPage"}
ParameterTypeRequiredDescription
docIdstringYesDocument ID
optionsobjectNo{type: nextPage

setDocProperties

Set document metadata properties (title, author, keywords)

Module: office | Returns: boolean -- true

office.setDocProperties $doc {"title": "Annual Report", "author": "Finance Dept"}
ParameterTypeRequiredDescription
docIdstringYesDocument ID
optionsobjectYes{title, author, subject, keywords, description}

addDocStyle

Define a reusable named paragraph or character style

Module: office | Returns: boolean -- true

office.addDocStyle $doc "Code Block" {"font": "Courier New", "fontSize": 10, "color": "333333"}
ParameterTypeRequiredDescription
docIdstringYesDocument ID
styleNamestringYesStyle name
optionsobjectNo{type: paragraph

addHeader

Add a custom header to the current section

Module: office | Returns: boolean -- true

office.addHeader $doc "Company Report 2026" {"alignment": "right", "fontSize": 9}
ParameterTypeRequiredDescription
docIdstringYesDocument ID
textstringYesHeader text
optionsobjectNo{type: default

addFooter

Add a custom footer with optional page numbers

Module: office | Returns: boolean -- true

office.addFooter $doc "Confidential" {"pageNumbers": true, "alignment": "center"}
ParameterTypeRequiredDescription
docIdstringYesDocument ID
textstringYesFooter text
optionsobjectNo{type: default

patchDoc

Modify an existing .docx by replacing placeholders with new content

Module: office | Returns: object -- {path}

office.patchDoc "./template.docx" "./output.docx" {"{{NAME}}": "John", "{{DATE}}": "2026-01-15"}
ParameterTypeRequiredDescription
inputPathstringYesPath to existing .docx
outputPathstringYesOutput .docx path
patchesobjectYes{"{{PLACEHOLDER}}": "replacement text"} or {"{{KEY}}": {runs: [{text, bold, color}]}}
optionsobjectNo{keepStyles}

addCheckbox

Add a checkbox with label text

Module: office | Returns: boolean -- true

office.addCheckbox $doc "I agree to the terms" {"checked": false}
ParameterTypeRequiredDescription
docIdstringYesDocument ID
labelstringYesCheckbox label
optionsobjectNo{checked: bool, bold, fontSize, font, color}

saveDoc

Save the Word document to a .docx file

Module: office | Returns: object -- {path, size}

office.saveDoc $doc "./report.docx"
ParameterTypeRequiredDescription
docIdstringYesDocument ID
filePathstringYesOutput .docx path

createSheet

Create a new Excel workbook

Module: office | Returns: string -- Workbook ID

office.createSheet "data" {"sheetName": "Products"} into $wb
ParameterTypeRequiredDescription
idstringNoWorkbook ID
optionsobjectNo{creator, title, sheetName}

readSheet

Read data from an existing Excel file

Module: office | Returns: array -- Array of row objects (header row becomes keys)

office.readSheet "./data.xlsx" "Sheet1" into $rows
ParameterTypeRequiredDescription
filePathstringYesPath to .xlsx file
sheetNamestringNoSheet name (optional, defaults to first)

addRow

Add a row with optional styling

Module: office | Returns: number -- Row number

office.addRow $wb "Sheet1" ["Name", "Price"] {"bold": true, "fillColor": "#2196F3", "color": "#FFFFFF"}
ParameterTypeRequiredDescription
wbIdstringYesWorkbook ID
sheetstringYesSheet name
valuesarrayYesRow values
optionsobjectNo{bold, fontSize, color, fillColor, alignment, borders}

writeData

Write array of objects to sheet with auto-headers and styling

Module: office | Returns: number -- Number of rows written

office.writeData $wb "Sheet1" $products {"headerStyle": {"fillColor": "#FF5722", "bold": true}}
ParameterTypeRequiredDescription
wbIdstringYesWorkbook ID
sheetstringYesSheet name
dataarrayYesArray of objects
optionsobjectNo{headerStyle, cellStyle, columnWidths, autoWidth}

writeCell

Write a value to a specific cell with formatting

Module: office | Returns: boolean -- true

office.writeCell $wb "A1" "Total:" {"bold": true, "fontSize": 14}
ParameterTypeRequiredDescription
wbIdstringYesWorkbook ID
cellstringYesCell reference (e.g. A1)
valueanyYesCell value
optionsobjectNo{sheet, bold, fontSize, color, fillColor, alignment, borders, numberFormat}

styleRange

Apply formatting to a range of cells

Module: office | Returns: boolean -- true

office.styleRange $wb "A1:D1" {"bold": true, "fillColor": "#2196F3", "color": "#FFFFFF"}
ParameterTypeRequiredDescription
wbIdstringYesWorkbook ID
rangestringYesCell range (e.g. A1:D10)
optionsobjectYes{sheet, bold, fontSize, color, fillColor, alignment, borders}

addFormula

Add a formula to a cell

Module: office | Returns: boolean -- true

office.addFormula $wb "B11" "SUM(B2:B10)" {"bold": true, "numberFormat": "#,##0.00"}
ParameterTypeRequiredDescription
wbIdstringYesWorkbook ID
cellstringYesCell reference
formulastringYesExcel formula (e.g. SUM(A1:A10))
optionsobjectNo{sheet, bold, numberFormat}

setColumnWidth

Set column widths

Module: office | Returns: boolean -- true

office.setColumnWidth $wb {"A": 25, "B": 15, "C": 40}
ParameterTypeRequiredDescription
wbIdstringYesWorkbook ID
columnsobjectYesColumn widths object {A: 20, B: 30}
optionsobjectNo{sheet}

mergeCells

Merge a range of cells

Module: office | Returns: boolean -- true

office.mergeCells $wb "A1:D1"
ParameterTypeRequiredDescription
wbIdstringYesWorkbook ID
rangestringYesCell range (e.g. A1:D1)
optionsobjectNo{sheet}

loadSheet

Load an existing Excel file for editing

Module: office | Returns: string -- Workbook ID

office.loadSheet "./data.xlsx" "wb1" into $wb
ParameterTypeRequiredDescription
filePathstringYesPath to .xlsx file
idstringNoWorkbook ID

addWorksheet

Add a new worksheet to an existing workbook

Module: office | Returns: string -- Sheet name

office.addWorksheet $wb "Revenue" {"tabColor": "#FF5722"}
ParameterTypeRequiredDescription
wbIdstringYesWorkbook ID
namestringYesSheet name
optionsobjectNo{tabColor}

freezePanes

Freeze header rows and/or columns

Module: office | Returns: boolean -- true

office.freezePanes $wb 1 0 {"sheet": "Sheet1"}
ParameterTypeRequiredDescription
wbIdstringYesWorkbook ID
rowsnumberYesNumber of rows to freeze
colsnumberNoNumber of columns to freeze
optionsobjectNo{sheet}

setAutoFilter

Add filter dropdowns on header columns

Module: office | Returns: boolean -- true

office.setAutoFilter $wb "A1:D1" {"sheet": "Products"}
ParameterTypeRequiredDescription
wbIdstringYesWorkbook ID
rangestringYesRange for filter (e.g. A1:D1)
optionsobjectNo{sheet}

addConditionalFormat

Add conditional formatting rules (color scales, data bars, icon sets, cell rules)

Module: office | Returns: boolean -- true

office.addConditionalFormat $wb "B2:B20" [{"type": "cellIs", "operator": "greaterThan", "value": 100, "fillColor": "#00FF00"}]
ParameterTypeRequiredDescription
wbIdstringYesWorkbook ID
rangestringYesCell range
rulesarrayYesRules: [{type: cellIs
optionsobjectNo{sheet}

addDataValidation

Add data validation (dropdowns, number/date constraints) to a cell

Module: office | Returns: boolean -- true

office.addDataValidation $wb "C2" {"type": "list", "values": ["Active", "Inactive", "Pending"], "sheet": "Sheet1"}
ParameterTypeRequiredDescription
wbIdstringYesWorkbook ID
cellRefstringYesCell reference
optionsobjectYes{sheet, type: list

addCellComment

Add a comment/note to a cell

Module: office | Returns: boolean -- true

office.addCellComment $wb "A1" "This value needs verification" {"author": "Reviewer"}
ParameterTypeRequiredDescription
wbIdstringYesWorkbook ID
cellRefstringYesCell reference
textstringYesComment text
optionsobjectNo{sheet, author}

addSheetImage

Embed an image in a spreadsheet

Module: office | Returns: boolean -- true

office.addSheetImage $wb "./chart.png" "E1:H10" {"sheet": "Sheet1"}
ParameterTypeRequiredDescription
wbIdstringYesWorkbook ID
imagePathstringYesPath to image file
rangestringNoCell range (e.g. A1:D10) or empty for position
optionsobjectNo{sheet, col, row, width, height}

addNamedRange

Define a named range for formulas

Module: office | Returns: boolean -- true

office.addNamedRange $wb "Prices" "$B$2:$B$100" {"sheet": "Products"}
ParameterTypeRequiredDescription
wbIdstringYesWorkbook ID
namestringYesRange name
rangestringYesCell range (e.g. $A$1:$A$10)
optionsobjectNo{sheet}

protectSheet

Protect a worksheet with a password and permission options

Module: office | Returns: boolean -- true

office.protectSheet $wb "secret123" {"sheet": "Sheet1", "selectLockedCells": true, "sort": true}
ParameterTypeRequiredDescription
wbIdstringYesWorkbook ID
passwordstringYesProtection password
optionsobjectNo{sheet, selectLockedCells, formatCells, insertRows, deleteRows, sort, autoFilter}

hideRowsColumns

Hide or show rows and columns

Module: office | Returns: boolean -- true

office.hideRowsColumns $wb {"rows": [5, 6], "columns": ["D"]} {"sheet": "Sheet1"}
ParameterTypeRequiredDescription
wbIdstringYesWorkbook ID
targetsobjectYes{rows: [1,2,3], columns: ['C','D']}
optionsobjectNo{sheet, hidden: bool}

saveSheet

Save the workbook to an .xlsx file

Module: office | Returns: object -- {path}

office.saveSheet $wb "./data.xlsx"
ParameterTypeRequiredDescription
wbIdstringYesWorkbook ID
filePathstringYesOutput .xlsx path

createSlides

Create a new PowerPoint presentation

Module: office | Returns: string -- Presentation ID

office.createSlides "deck" {"title": "Q4 Report"} into $ppt
ParameterTypeRequiredDescription
idstringNoPresentation ID
optionsobjectNo{title, author, layout}

addSlide

Add a slide with optional title/subtitle and background

Module: office | Returns: number -- Slide index

office.addSlide $ppt {"title": "Overview", "subtitle": "Q4 2026", "backgroundColor": "#1a1a2e"} into $slideIdx
ParameterTypeRequiredDescription
pptIdstringYesPresentation ID
optionsobjectNo{title, subtitle, titleSize, backgroundColor}

addSlideText

Add a text box to a slide with full formatting

Module: office | Returns: boolean -- true

office.addSlideText $ppt 0 "Revenue: +23%" {"x": 1, "y": 3, "fontSize": 24, "bold": true, "color": "#27ae60"}
ParameterTypeRequiredDescription
pptIdstringYesPresentation ID
slideIndexnumberYesSlide index
textstringYesText content
optionsobjectNo{x, y, w, h, fontSize, font, bold, italic, color, alignment, fillColor, bullet, lineSpacing}

addSlideImage

Add an image to a slide with positioning

Module: office | Returns: boolean -- true

office.addSlideImage $ppt 0 "./chart.png" {"x": 1, "y": 2, "w": 6, "h": 4}
ParameterTypeRequiredDescription
pptIdstringYesPresentation ID
slideIndexnumberYesSlide index
imagePathstringYesPath to image
optionsobjectNo{x, y, w, h, rounding, hyperlink}

addSlideTable

Add a data table to a slide with styling

Module: office | Returns: boolean -- true

office.addSlideTable $ppt 1 $data {"headerStyle": {"fillColor": "#2196F3"}, "alternateRows": true}
ParameterTypeRequiredDescription
pptIdstringYesPresentation ID
slideIndexnumberYesSlide index
dataarrayYesArray of objects or arrays
optionsobjectNo{x, y, w, headerStyle, cellStyle, columnWidths, alternateRows, borders}

addSlideChart

Add a chart to a slide

Module: office | Returns: boolean -- true

office.addSlideChart $ppt 2 $chartData {"type": "bar", "title": "Sales by Region"}
ParameterTypeRequiredDescription
pptIdstringYesPresentation ID
slideIndexnumberYesSlide index
chartDataarrayYesChart data series [{name, labels, values}]
optionsobjectNo{type: bar

addSlideShape

Add a shape to a slide

Module: office | Returns: boolean -- true

office.addSlideShape $ppt 0 {"shape": "rect", "x": 0, "y": 0, "w": 10, "h": 0.5, "fillColor": "#2196F3"}
ParameterTypeRequiredDescription
pptIdstringYesPresentation ID
slideIndexnumberYesSlide index
optionsobjectNo{shape: rect

addSlideNotes

Add speaker notes to a slide

Module: office | Returns: boolean -- true

office.addSlideNotes $ppt 0 "Remember to mention Q4 targets"
ParameterTypeRequiredDescription
pptIdstringYesPresentation ID
slideIndexnumberYesSlide index
textstringYesSpeaker notes text

addSlideMultiText

Add rich text with mixed formatting (bold/italic/color) in one text box

Module: office | Returns: boolean -- true

office.addSlideMultiText $ppt 0 [{"text": "Revenue: ", "bold": true}, {"text": "+23%", "color": "#27ae60", "bold": true}] {"x": 1, "y": 3}
ParameterTypeRequiredDescription
pptIdstringYesPresentation ID
slideIndexnumberYesSlide index
runsarrayYesArray of text runs [{text, bold, italic, color, fontSize, font, hyperlink}]
optionsobjectNo{x, y, w, h, alignment, fillColor, lineSpacing, margin}

setSlideNumber

Add a slide number to a slide

Module: office | Returns: boolean -- true

office.setSlideNumber $ppt 0 {"x": 9.5, "y": "95%", "color": "#888888", "fontSize": 10}
ParameterTypeRequiredDescription
pptIdstringYesPresentation ID
slideIndexnumberYesSlide index
optionsobjectNo{x, y, color, fontSize}

defineSlideMaster

Define a reusable slide master template with logo, background, and placeholders

Module: office | Returns: boolean -- true

office.defineSlideMaster $ppt "BRAND" {"bgColor": "#FFFFFF", "objects": [{"rect": {"x": 0, "y": 0, "w": "100%", "h": 0.5, "fillColor": "#003366"}}]}
ParameterTypeRequiredDescription
pptIdstringYesPresentation ID
namestringYesMaster template name
optionsobjectNo{background, bgColor, margin, slideNumber, objects: [{rect: {...}}, {text: {...}}, {image: {...}}]}

addSlideFromMaster

Create a new slide from a defined master template

Module: office | Returns: number -- Slide index

office.addSlideFromMaster $ppt "BRAND" {} into $slideIdx
ParameterTypeRequiredDescription
pptIdstringYesPresentation ID
masterNamestringYesMaster template name
optionsobjectNo{backgroundColor}

saveSlides

Save the presentation to a .pptx file

Module: office | Returns: object -- {path}

office.saveSlides $ppt "./presentation.pptx"
ParameterTypeRequiredDescription
pptIdstringYesPresentation ID
filePathstringYesOutput .pptx path

setSheetPrint

Configure print layout: paper size, orientation, print area, margins

Module: office | Returns: boolean -- true

office.setSheetPrint $wb {"sheet": "Sheet1", "paperSize": 9, "orientation": "landscape", "printArea": "A1:F20"}
ParameterTypeRequiredDescription
wbIdstringYesWorkbook ID
optionsobjectYes{sheet, paperSize: 9=A4, orientation, fitToPage, fitToWidth, fitToHeight, printArea, margins: {left, right, top, bottom, header, footer}, printTitlesRow}

groupRows

Group rows (or columns) into collapsible outline groups

Module: office | Returns: boolean -- true

office.groupRows $wb 2 10 {"sheet": "Sheet1", "collapsed": false}
ParameterTypeRequiredDescription
wbIdstringYesWorkbook ID
startnumberYesStart row number
endnumberYesEnd row number
optionsobjectNo{sheet, level, collapsed, columns: {start, end, level}}

Error Handling

All functions throw on failure. Common errors:

ErrorCause
Table data must be a non-empty arrayCheck the error message for details
List items must be an arrayCheck the error message for details
Worksheet not foundCheck the error message for details
Slide ${slideIdx} not foundCheck the error message for details
Table data requiredCheck the error message for details
runs must be an array of text run objectsCheck the error message for details
Document "..." not foundCheck the error message for details
Workbook "..." not foundCheck the error message for details
@desc "Create doc and validate result"
do
  set $result as office.createDoc "report" {"margins": {"top": 1, "bottom": 1}} into $doc
  if $result != null
    print "Success"
  else
    print "No result"
  end
enddo

Recipes

1. Create a new item with createDoc

Create a new resource and capture the result.

set $result as office.createDoc "report" {"margins": {"top": 1, "bottom": 1}} into $doc
print "Created: " + $result

2. Multi-step Office workflow

Chain multiple office operations together.

@desc "Create doc, read doc, and more"
do
  set $r_createDoc as office.createDoc "report" {"margins": {"top": 1, "bottom": 1}} into $doc
  set $r_readDoc as office.readDoc "./contract.docx" "text" into $content
  set $r_addHeading as office.addHeading $doc "Sales Report" 1 {"color": "#2196F3", "alignment": "center"}
  print "All operations complete"
enddo

3. Safe createDoc with validation

Check results before proceeding.

@desc "Create doc and validate result"
do
  set $result as office.createDoc "report" {"margins": {"top": 1, "bottom": 1}} into $doc
  if $result != null
    print "Success: " + $result
  else
    print "Operation returned no data"
  end
enddo

Related Modules

  • pdf -- PDF module for complementary functionality
  • excel -- Excel module for complementary functionality
  • docusign -- DocuSign module for complementary functionality
  • pandadoc -- PandaDoc module for complementary functionality
  • hellosign -- HelloSign module for complementary functionality

Versions (1)

VersionTagPublished
0.1.4latest1 months ago
Install
$ robinpath add @robinpath/office

Collaborators

Dumitru Balaban
Dumitru Balaban
@dumitru
View all @robinpath modules
Version0.1.4
LicenseMIT
Unpacked Size14.9 KB
Versions1
Weekly Downloads21
Total Downloads21
Stars0
Last Publish1 months ago
Created1 months ago

Category

productivity