Skip to content

Word

NappAI has two components for working with Word documents stored in Microsoft 365. In the editor you find them in the Microsoft group with these names:

  • Document works with a document’s content: it reads it, inserts paragraphs or text, finds and replaces words, shows its structure and applies formatting.
  • Management handles the files: it searches for documents in a folder, looks up their details, creates them (also from a template), copies them and deletes them.

Both work with documents in .docx format.

When to use it

  • You want to generate a contract or a proposal from a Word template, filling in the client’s name and the terms.
  • An AI agent needs to read a Word document to answer questions about it.
  • You need to update a date, a price or a name that appears several times in a document.
  • You want to find every Word document in a folder to process them.
  • Before changing a document, you want to save a copy in another folder.

Document

Configuration

You need a Microsoft Word credential, which connects by signing in with your Microsoft account. When you create it you choose the access level: with Read Only you can only read; to change documents, choose Full Access. See Credentials.

FieldWhat it does
Credential (required)The Microsoft Word credential used to access your documents.
Operation (required)What the component does. See the Document operations table. By default, Get Document Content.
Selection ModeHow you point to the document: By Selector (you pick it in your OneDrive) or By Manual Entry (you type its identifier). By default, By Selector.
Select Documents (required)The document you work with, picked in your OneDrive. With By Selector.
Document ID (required)The document’s identifier. You get it with Management and the Search Documents operation. With By Manual Entry.
Drive IDThe identifier of the OneDrive drive or the SharePoint library where the document is. Empty, your OneDrive is used. With By Manual Entry.
Content FormatHow the content is returned: plain_text, html, markdown or structured (split into paragraphs). By default, plain_text. Only in Get Document Content.
Paragraph TextThe text of the new paragraph. Only in Insert Paragraph.
Text ContentThe text added inside an existing paragraph. Only in Insert Text.
Insert PositionWhere it is inserted. In Insert Paragraph: Start (at the beginning of the document), End (at the end), Before Paragraph or After Paragraph (before or after a specific paragraph); by default, End. In Insert Text: Before Paragraph (at the start of the paragraph) or After Paragraph (at the end of the paragraph).
Paragraph IndexThe number of the reference paragraph, counting from 0 for the first one. It appears when Insert Position is Before Paragraph or After Paragraph.
Search TextThe text to find. In Search Text and Replace Text. In Apply Formatting, the text the formatting is applied to; empty, it is applied to the whole document.
Replace TextThe text that replaces the one found. Only in Replace Text.
Replace ModeHow it is replaced: first_occurrence (only the first match), all_occurrences (all of them), case_sensitive (all of them, matching upper and lower case) or whole_words_only (only whole words). By default, all_occurrences. Only in Replace Text.
Formatting OptionsThe formatting applied: bold (true or false), italic (true or false), color (for example #FF0000) and font_size (size in points). Only in Apply Formatting.

Document operations

OperationWhat it does
Get Document ContentReturns the document’s text in the chosen format, with the number of characters and words.
Insert ParagraphAdds a new paragraph at the beginning, at the end or next to a specific paragraph.
Insert TextAdds text at the start or the end of an existing paragraph.
Search TextFinds a text and returns where it appears and how many times.
Replace TextReplaces one text with another and returns how many changes it made.
Get Document StructureReturns the document’s paragraphs, tables and images, with each paragraph’s number. It helps you know which Paragraph Index to use.
Apply FormattingApplies bold, italics, colour or font size to a text or to the whole document.

Document output

The Data output returns a single item with the result: the extracted text, the matches found, the document’s structure or the confirmation of the change made. If an operation fails, the output contains an item with the error message instead of stopping the flow.

Management

Configuration

It uses the same Microsoft Word credential. To create, copy or delete documents you need Full Access.

FieldWhat it does
Credential (required)The Microsoft Word credential used to access your documents.
Operation (required)What the component does. See the Management operations table. By default, Search Documents.
ModeSimple shows only the essential fields; Advanced adds Search Query, Template Data and New Document Name. By default, Simple. In Search Documents, Copy Document and Create Document.
Selection ModeHow you point to folders and documents: By Selector (you pick them in your OneDrive) or By Manual Entry (you type their paths and identifiers in Folder Path, Target Folder Path, Document ID and Drive ID). By default, By Selector.
Select Folder Path (required)The folder where you search or where the document is created. In Search Documents and Create Document.
Select Documents (required)The document you work with. In Delete Document, Get Document Info and Copy Document.
Select Target Folder Path (required)The folder where the copy is saved. Only in Copy Document.
Document Name (required)The new document’s name. If it does not end in .docx, it is added. Only in Create Document.
Search QueryText searched for in the documents’ name or content. Empty, the Word documents in the folder are returned. Only with Mode set to Advanced, in Search Documents.
Shallow SearchWhen on, only the given folder is searched; when off, its subfolders too. Off by default. Only in Search Documents.
Documents CountThe maximum number of documents returned. By default, 50. Only in Search Documents.
Template DataTo create the document from a template. Give template_path, the path of the template in your OneDrive, and replacements, the template’s placeholders and the text that replaces them, for example {{client}} with Ribera Construction. Empty, a blank document is created. Only with Mode set to Advanced, in Create Document.
New Document NameThe name of the copy. Empty, the original name with (copy) is used. Only with Mode set to Advanced, in Copy Document.

Management operations

OperationWhat it does
Search DocumentsSearches for Word documents in a folder and returns their name, identifier, link, size and modification date.
Delete DocumentDeletes a document.
Get Document InfoReturns a document’s details: size, access and download links, dates, who created it and who last modified it.
Copy DocumentCopies a document to another folder.
Create DocumentCreates a new document, blank or from a template.

Management output

The Data output returns one item for each document found, or a single item with the result: the document created or copied with its identifier and link, its details or the confirmation of the deletion. If an operation fails, the output contains an item with the error message instead of stopping the flow.

Both components can be connected to an Agent as a tool, so the agent decides when to read, edit or create documents. See Tool Mode.

Example

An advisory firm wants to prepare each new client’s engagement letter automatically from its template.

  1. In OneDrive, the template /Templates/Engagement letter.docx contains placeholders such as {{client}} and {{date}}.
  2. Add Management with the Create Document operation, the firm’s Microsoft Word credential and Mode set to Advanced.
  3. In Select Folder Path, pick the Clients folder; in Document Name, the client’s name followed by Engagement letter; and in Template Data, the template’s path and the values for {{client}} and {{date}}.
  4. If you want to highlight the client’s name, connect the result to Document with the Apply Formatting operation, the name in Search Text and bold in Formatting Options.

Good practices

  • Before using Insert Paragraph or Insert Text next to a specific paragraph, look up its number with Get Document Structure.
  • Before replacing text in an important document, make a copy with Copy Document.
  • Delete Document does not ask for confirmation.
  • Excel: read and write data in Excel workbooks.
  • Files: read, upload and manage OneDrive files.
  • Search: search for files in OneDrive and SharePoint.