Free plan

Find and replace in Office file

Find a word and replace it everywhere in an Office file
POST
/v1/documents/replace-text

About this tool

This tool finds a word or phrase in a Word, PowerPoint or Excel file and replaces it everywhere with new text. The look of the text is kept. You can do many replacements at once, match capital letters exactly, or match whole words only. It also changes headers, footnotes and speaker notes.
For example, your company changed its name and you update every mention in a contract.

How to use it

  1. Choose this tool.
  2. Add your Word, PowerPoint or Excel file.
  3. Type the text to find and the text to put instead, or add several pairs.
  4. Choose whether capital letters and whole words must match.
  5. Press Generate.

What you get back

You get a new file with the changes to download, and the number of replacements made.
GOOD TO KNOW
Word: body, headers, footers, footnotes, endnotes. PowerPoint: slides and notes. Excel: text cells. OpenDocument files are not supported. Counts as one document.
TEST IT LIVE

Try Find and replace in Office file in the Studio

One click opens the Studio with this tool already selected. Add your file and see the result in seconds.
Open in the Studio
Family
Documents
Plan
Free
Method
POST
Endpoint
/v1/documents/replace-text
Tool ID
documents.replace-text
Authentication
API key
Accepts
Text and settings
Background jobs
Yes
Usage group
Documents
For developers

Use it from your code

cURL

curl -X POST "https://app.h2i.davixlabs.io/v1/documents/replace-text" \
  -H "X-Api-Key: $DAVIX_H2I_API_KEY" \
  -F 'file=@document.pdf' \
  -F 'find=Acme Ltd' \
  -F 'replace=Acme Inc' \
  -F 'rules=[{"find":"2025","replace":"2026"}]'

Node.js

const { DavixH2I } = require('@davixlabs/h2i-sdk');

const h2i = new DavixH2I({ apiKey: process.env.DAVIX_H2I_API_KEY, baseUrl: process.env.DAVIX_H2I_URL });
const result = await h2i.documents.replaceText({
    "file": 'document.pdf',
    "find": "Acme Ltd",
    "replace": "Acme Inc",
    "rules": "[{\"find\":\"2025\",\"replace\":\"2026\"}]"
  });
console.log(result.data, result.requestId);

PHP

<?php
require 'vendor/autoload.php';

$h2i = new \Davix\H2I\Client(['apiKey' => getenv('DAVIX_H2I_API_KEY'), 'baseUrl' => getenv('DAVIX_H2I_URL')]);
$result = $h2i->documents()->replaceText([
    'file' => 'document.pdf',
    'find' => 'Acme Ltd',
    'replace' => 'Acme Inc',
    'rules' => '[{"find":"2025","replace":"2026"}]',
]);
echo $result->requestId;
FAQ

Frequently asked questions

Find and replace text in a Word, PowerPoint or Excel file even when the phrase is split over several runs of text; the replacement keeps the formatting of the run where the match starts.

Find and replace in Office file works from text and settings, so no file is needed. Every input is optional.

Find and replace in Office file is included in every plan, including Free. Each run uses credits from your monthly allowance.

Send a POST request to /v1/documents/replace-text with your API key in the X-Api-Key header. Official SDKs for Node.js, Python, PHP, Go, Java, .NET and Ruby do the same for you, and the code box on this page shows ready-to-copy examples. For large work it can also run as a background job, so your request returns straight away.