Public
Edited
Jun 12, 2019
Importers
4 stars
Insert cell
Insert cell
Insert cell
csvData = csvzator.generate({
size: 12,
columns: [
{ name: "idx", gen: csvzator.generators.cpf(true, true) },
{ name: "col2", gen: csvzator.generators.int() },
{ name: "col3", gen: csvzator.generators.int() },
{ name: "col4", gen: csvzator.generators.int() },
{ name: "col5", gen: csvzator.generators.int() },
{ name: "category", gen: csvzator.generators.text(["A","B","C","D","E"]) }
]
})
Insert cell
Insert cell
html`${matrixToHtml(csvData, true)}`
Insert cell
Insert cell
Insert cell
Insert cell
html`${matrixToHtml(csvzator.generate({...parsedConfig, size:3}), true)}`
Insert cell
csvzator.toText(csvzator.generate({...parsedConfig, size:4}))
Insert cell
csvzator.toText(csvzator.generate({...parsedConfig, size:4, withTitle:false}))
Insert cell
{
let t = ""
csvzator.streamGenerate({
...parsedConfig,
size:5,
packageSize:2,
callback: data => t+=csvzator.toText(data)+"\n"
})
return t
}
Insert cell
{
const btn = html`<button style="font-size:20px; margin:1em; cursor:pointer;">Download</button>`

function download(content, filename) {
const contentType = 'application/csv';
var a = document.createElement('a');
var blob = new Blob([content], {'type':contentType});
a.href = window.URL.createObjectURL(blob);
a.download = filename;
a.click();
}
btn.onclick=() => { download(
csvzator.toText(csvzator.generate(parsedConfig)),
"file.csv"
) }
return btn
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more