Skip to Content
NexPDF

Edit Excel and Word files

Change cells and recalculate formulas, or replace text in Word documents.

English

These endpoints change an Office file and give the same kind of file back, keeping its formatting. They need a live key.

Cost: 1 unit per file.

Excel

POST /v1/xlsx/edit takes the workbook in document and the changes in edits: the sheet, a list of cells with a value or a formula, and recalculate to update every formula that depends on them.

curl https://api.nexpdf.dev/v1/xlsx/edit \
  -H "Authorization: Bearer $NEXPDF_API_KEY" \
  -F document=@budget.xlsx \
  -F 'edits={
    "sheet": "Budget",
    "edits": [
      {
        "cell": "C2",
        "value": 6.5
      },
      {
        "cell": "C3",
        "formula": "=C2*12"
      }
    ],
    "recalculate": true
  }' \
  -o budget-updated.xlsx

Word

POST /v1/docx/edit takes the document in document and a list of operations in ops. replace changes every occurrence of find, which makes it a simple way to fill templates.

curl https://api.nexpdf.dev/v1/docx/edit \
  -H "Authorization: Bearer $NEXPDF_API_KEY" \
  -F document=@offer.docx \
  -F 'ops=[
    {
      "op": "replace",
      "find": "{{name}}",
      "replace": "Jane Doe"
    },
    {
      "op": "replace",
      "find": "{{salary}}",
      "replace": "€ 52,000"
    }
  ]' \
  -o offer-jane.docx

On this page