Update File

🧾 Definition

The “Update File” action in the OneDrive category allows you to replace the content of an existing file in your OneDrive account while retaining its metadata (such as the file name, path, and ID). This action is especially useful when you want to programmatically overwrite a file with a newer version without manually deleting or re-uploading it.

Key capabilities include:

  • Seamless content replacement for supported file types (e.g., documents, images, text files).
  • Flexible file selection via path, ID, or UI-based picker.
  • Integration with previous steps using token picker to dynamically select files.
  • Secure, authenticated file update with support for payloads up to 15MB.

It ensures that version consistency is maintained across your workflows, especially when collaborating, automating document generation, or managing file backups.



📘 Example Use Cases

  1. Automated Document Replacement Automatically update a report, invoice, or presentation file in OneDrive with new content generated from another system (e.g., replacing a sales report PDF every Monday).

  1. Image Version Updates Replace existing images (e.g., product photos or marketing banners) in OneDrive with new versions from a design tool, without changing the file link.

  1. Real-Time File Syncing Across Platforms Use this action to sync a file from Google Drive or Dropbox to OneDrive by retrieving the file content and updating the matching file in OneDrive.

  1. Dynamic File Editing in Workflows After modifying a file's content (e.g., appending data to a CSV or updating a DOCX), this action lets you upload the edited version directly into OneDrive, replacing the old one.

  1. Template Overwrite Based on User Inputs In form automation workflows, generate a document from a user submission and overwrite an existing template file with the personalized version.


🧾 Inputs

  1. ConnectionThis field establishes a secure link between your workspace and the OneDrive account where the file is stored. You must select or configure a valid OneDrive Business connection before proceeding.

  1. Selecting FileThis is the specific file in OneDrive that you want to update with new content.

    You can identify the file in two ways:

    • Option 1: OneDrive Sign-In PickerClick the field to open your OneDrive and manually select the file you want to update.

    • Option 2: Manual ID or PathUse a dynamic token from a previous step or hardcode the value directly:

      • If Select by Path is disabled, provide the file ID (e.g., 1EED600A8F0FD9A1!s75181466e59d4bacb1ec55930b932ed1).
      • If Select by Path is enabled, provide the full file path (e.g., /drive/root:/Pictures/Screenshot 2023-05-10 125216.png).

  1. File PayloadThis is the binary content of the new file that will replace the existing file in OneDrive.

    Important guidelines:

    • Ensure the file has the same extension and type as the file you are replacing (e.g., replace .png with .png, not .pdf).

    • You can get this payload from other steps that output file content, such as:

      • "Find File/Folder" in Google Drive
      • "Get File Content" from OneDrive, Dropbox, etc.
    • The maximum supported size is 15 MB.

    This field essentially delivers the new version of the file, which the action will use to overwrite the old one.



📤 Outputs

  1. File IDThe unique identifier of the file in OneDrive after it has been updated. You can use this ID in subsequent actions (e.g., to move, rename, or retrieve file content).

  1. NameThe name of the file after the update. This will remain the same unless the file was renamed before the update.

  1. File PathThe complete OneDrive path to the file, showing its location within the user's OneDrive directory structure (e.g., /drive/root:/Documents/UpdatedReport.xlsx).

  1. Web URLA shareable web link to access the file via the OneDrive interface. This URL opens the file in a browser view, depending on the file type (e.g., document preview, image view, etc.).

  1. Download URLA direct, pre-authenticated link to download the file. No additional sign-in or access token is needed when using this URL, making it ideal for passing the file downstream or sending it in notifications.

  1. MIME TypeThe MIME type (Multipurpose Internet Mail Extensions Type) that describes the format of the updated file. Examples include:

    • application/pdf for PDFs
    • image/png for PNG images
    • application/vnd.openxmlformats-officedocument.wordprocessingml.document for DOCX files

    This helps identify the content type programmatically.


  1. SizeThe total size of the updated file (in bytes). Useful when validating upload success, checking against size limits, or logging.


📘 Example Scenario: Auto-Update a Weekly Report File in OneDrive

🔹 Scenario Overview:

Let’s say your team generates a weekly sales report using a data analytics tool (like Power BI, Excel Online, or Google Sheets) and you want to automatically replace the existing version stored in OneDrive every Monday morning with the latest report — without changing the file name or OneDrive link.


🔹 How This Works in Practice:

  1. **Trigger:**A scheduled trigger runs every Monday at 9 AM.

  2. **Generate Report:**A "Generate Report" action creates a new file with the latest sales data and stores it temporarily.

  3. **Find File to Replace:**Use a "Find File/Folder" action to locate the existing report in OneDrive (e.g., /Reports/WeeklySalesReport.xlsx) and get its file ID.

  4. **Update File:**Now, using the "Update File" action:

    • In the "Selecting File" field, provide the file ID of the existing report.
    • In the "File Payload" field, pass the binary content of the new file (retrieved from the report generation step).
    • The system replaces the old content with the new one, but keeps the file name and OneDrive URL unchanged.

🔹 Why This Is Useful:

  • Internal teams or stakeholders already have the link to this file — no need to share a new one each week.
  • Keeps your OneDrive clean with a single source of truth, rather than multiple report versions.
  • Saves time by automating manual file replacement.


✅ Best Practices


  1. Match File Types ExactlyEnsure the replacement file has the same format and extension as the existing file.

    For example, you can only replace a .docx file with another .docx, not a .pdf.


  1. Stay Within the 15MB File Size LimitOnly use this action for files that are 15MB or smaller.

    For larger files, consider storing them externally or splitting them before upload.


  1. Use Reliable Payload SourcesAlways pass the File Payload from a trusted step — such as a "Download File", "Find File", or "Get File Content" action.

    Avoid using placeholder or incomplete binary content to prevent upload failures.


  1. Use ID Over Path for StabilityIf possible, use File ID instead of path when referencing the target file — this ensures the file can still be updated if it's renamed or moved.

    Paths are more human-readable but less reliable over time.


  1. Ensure File Isn’t In Use or LockedAvoid updating files that are actively open or being edited in another OneDrive session, especially for Excel or Word files.

    This prevents sync errors or version conflicts.