---
title: "write(to:)"
framework: automator
role: symbol
role_heading: Instance Method
path: "automator/amworkflow/write(to:)"
---

# write(to:)

Writes the workflow to the specified file.

## Declaration

```swift
func write(to fileURL: URL) throws
```

## Parameters

- `fileURL`: URL that specifies the file location to write the workflow.

## Discussion

Discussion You might want to save the workflow, for example, because you have made changes to a variable it contains. note: In Swift, this method returns Void and is marked with the throws keyword to indicate that it throws an error in cases of failure. You call this method in a try expression and handle any errors in the catch clauses of a do statement, as described in Error Handling in The Swift Programming Language and About Imported Cocoa Error Parameters.
