Skip to main content

AI Document Editing with Code Execution

AI Document Editing with Code Execution

Hatz can use Code Execution to create, edit, analyze, and transform documents, presentations, spreadsheets, PDFs, charts, and other files directly from chat, apps, or workflows.

When you upload document files, Hatz should bind Code Execution automatically for document work. For broader file-generation requests, turn on Auto-Tool so Hatz can select the tools needed for the task, including Code Execution when it needs to create or edit a real file.

Editing older uploads: Documents uploaded before this feature was enabled may not be editable. This includes files in existing chats and constants referenced in Agents, Apps, and Workflows. If you encounter an error, re-upload the document and try again.

Quick start

  1. Turn on Auto-Tool.

  2. Upload the document, spreadsheet, PDF, or presentation you want Hatz to work with.

  3. Tell Hatz exactly what to change, analyze, or produce.

  4. Ask for the result as a downloadable generated file.

  5. Download the result from the Generated file card.

Example: Use Code Execution on this spreadsheet. Add a summary sheet, save the result as client_summary.xlsx, and return it as a downloadable file.

Supported file types

File type

Common extensions

Documents

.docx, .pdf, .txt

Spreadsheets

.csv, .xlsx

Presentations

.pptx

Images and charts

.png, .jpg

Bundles

.zip

Legacy Office formats such as .doc, .xls, and .ppt should be opened in Microsoft Office and saved as modern formats before uploading. Macro-enabled files are not supported for macro execution.

What Hatz can do

  • Word documents: replace text, update formatting, add generated content, summarize, extract tables, and create new .docx files.

  • Spreadsheets: clean data, remove duplicates, merge files, calculate summaries, create charts, recalculate formulas when requested, and export .xlsx or .csv files.

  • PowerPoint: update text, reorder slides, duplicate slides, merge decks, generate slides from structured data, and create updated .pptx files.

  • PDFs: extract text, merge or split pages, rotate pages, fill forms, add overlays, and convert content into editable formats when possible.

Files, downloads, and persistence

  • Your original upload is not overwritten. Hatz creates a new output file.

  • Successful outputs appear as Generated file cards with a download button.

  • Generated files are available for a limited time. If a file is no longer available, ask Hatz to regenerate it or rerun the request.

  • Some organizations restrict direct downloads. If direct downloads are not available, you may need to use Microsoft 365 export or contact your Hatz administrator.

If Hatz returns a sandbox path

A path such as /home/daytona/workspace/output/updated_deck.pptx means the file exists inside the Code Execution workspace. It is not a browser download link.

  • Ask Hatz to create a downloadable generated file for that exact path.

  • Rerun with Auto-Tool on and ask Hatz to return the output as a downloadable file.

  • In workflows, check the run output and the relevant step output for a generated file card.

Best practices

  • Be specific about the file, page, slide, sheet, column, or section to update.

  • Tell Hatz what formatting or structure to preserve.

  • Specify the desired output file name and format.

  • For multi-step editing, refer to the new file Hatz just created. Example: Now filter the data in the new file you just created.

  • For many outputs, ask Hatz to place everything in one zip file.

Limitations

  • Password-protected or encrypted files must be unlocked before uploading.

  • Scanned PDFs depend on OCR quality and may need manual review.

  • PDF-to-Word conversion is not always pixel-perfect, especially for complex layouts.

  • PowerPoint edits can preserve structure, but very long replacement text may overflow existing slide shapes.

  • Formula recalculation should be requested explicitly.

  • Interactive Excel objects such as pivot tables may be returned as static calculated outputs rather than live Excel objects.

Example prompts

  • Replace all instances of Acme Corp with Hatz AI. Keep headings and table formatting unchanged. Return the updated .docx file.

  • Analyze this CSV, calculate month-over-month growth, create a bar chart for the top 5 regions, and return an Excel file plus a PDF summary.

  • Update this deck with the attached notes, shorten each title to under 7 words, and return the updated .pptx file.

  • Merge these PDFs, rotate pages 3 through 5 to portrait, and return the merged PDF.

Troubleshooting

  • If Hatz says it created a file but no generated file appears, turn on Auto-Tool and rerun.

  • If Hatz returns a sandbox path, ask it to create a downloadable generated file for that path.

  • If generated files could not be saved, try fewer outputs, smaller files, a common file type, or one zip file.

  • If a download fails, see Can't Access File Generated In Chat.

Did this answer your question?