1.0.14 • Published 4 years ago
simple_html_to_excel v1.0.14
simple_html_to_excel
export Excel file in HTML element contents.
install
npm install simple_html_to_excel --save
use
import { exportExcelById } from 'simple_html_to_excel'
exportExcelById('element_id')
<script type="module" src="https://unpkg.com/simple_html_to_excel@latest/dist/main.js" charset="utf-8"></script>
...
<script>
function download(id) {
html_to_excel.exportExcelById(id)
}
</script>
methods
- exportExcelById
- Download Excel file by element uniq id
- exportExcelByHtml
- Download Excel file by HTML text (element.innerHTML)
arguments
- exportExcelById
argument | required | type | default |
---|---|---|---|
elementId | true | string | - |
fileName | false | string | download.xls |
sheetName | false | string | Worksheet |
exportExcelByHtml
argument required type default html true string - fileName false string download.xls sheetName false string Worksheet
warning
- Only simple type exports
- Displayed in a better format when using table elements.
- Excel notification(type error) is displayed when you open the downloaded file.