---
title: "writeCSV(to:options:)"
framework: tabulardata
role: symbol
role_heading: Instance Method
path: "tabulardata/dataframeprotocol/writecsv(to:options:)"
---

# writeCSV(to:options:)

Creates a CSV file with the contents of the data frame type.

## Declaration

```swift
func writeCSV(to url: URL, options: CSVWritingOptions = .init()) throws
```

## Parameters

- `url`: A location URL in the file system where the method saves the CSV file.
- `options`: A doc://com.apple.TabularData/documentation/TabularData/CSVWritingOptions instance.

## See Also

### Saving a Data Frame Type to a CSV Format

- [csvRepresentation(options:)](tabulardata/dataframeprotocol/csvrepresentation(options:).md)
