Published
Edited
Feb 1, 2021
Insert cell
md`# xlsx-populate parse and set style demo`
Insert cell
XlsxPopulate = require('https://bundle.run/xlsx-populate@1.21.0')
Insert cell
dataFileWithBorder = FileAttachment("crime_2016.xlsx")
Insert cell
workbook = XlsxPopulate.fromDataAsync(await dataFileWithBorder.blob())
Insert cell
Insert cell
{
b2;
workbook.sheet(0).usedRange().style('border', true);
workbook.outputAsync()
.then(function (blob) {
if (window.navigator && window.navigator.msSaveOrOpenBlob) {
// If IE, you must uses a different method.
window.navigator.msSaveOrOpenBlob(blob, "out.xlsx");
} else {
var url = window.URL.createObjectURL(blob);
var a = document.createElement("a");
document.body.appendChild(a);
a.href = url;
a.download = "out.xlsx";
a.click();
window.URL.revokeObjectURL(url);
document.body.removeChild(a);
}
})
}
Insert cell
import {button} from "@jashkenas/inputs"
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