---
title: "system.dataset.dataSetToHTML"
description: "Formats the contents of a dataset as an HTML page, returning the results as a string."
---
# system.dataset.dataSetToHTML
> Formats the contents of a dataset as an HTML page, returning the results as a string.
This function is used in **Python Scripting**.
## Description
Formats the contents of a dataset as an HTML page, returning the results as a string. Uses the < table > element to create a data table page.
## Client Permission Restrictions
This scripting function has no [Client Permission](projects\project-properties\project-properties.md#client---permissions) restrictions.
## Syntax
`system.dataset.dataSetToHTML(showHeaders, dataset, title)`
### Parameters
Type | Parameter | Description
------- | ------- | -------
Boolean | `showHeaders` | If True (1), the spreadsheet will include a header row.
Dataset | `datasets` | The dataset to export
String | `title` | The title for the HTML page.
### Returns
**String** - The HTML page as a string.
### Scope
All
## Code Examples
```python title="Example 1"
# This snippet would run a SQL query against a database, and turn the results into a string containing HTML. It then writes the string to a file on the local hard drive.
results = system.db.runQuery("SELECT * FROM example1 LIMIT 100")
results = system.dataset.toDataSet(results)
html = system.dataset.dataSetToHTML(1, results, "Production Report")
filePath = "C:\\output\\results.html"
system.file.writeFile(filePath, html)
```