Published
Edited
May 16, 2020
2 stars
Insert cell
md `# Lodash and Excel`
Insert cell
md `### We will import Excel & Process it`
Insert cell
xlsx = require('https://bundle.run/xlsx@0.14.1')
Insert cell
md `## Import File Here`
Insert cell
viewof binary = html`<input type=file>`
Insert cell
Insert cell
Insert cell
fpcData = lodash
.chain(as_json)
.filter(data => ( (lodash.includes(data['Customer'], "EBT6G")) && (data['English Name of sites'] == "CHINA" || data['English Name of sites'] == "UNITED ARAB EMIRATES")))
.groupBy("FPC")
.map((fpcData,key) => {
return {
fpc: key,
jan2019: lodash.sumBy(fpcData, "201901"),
apr2020: lodash.sumBy(fpcData, "202004"),
}
})
.value()
Insert cell
Insert cell
Insert cell
Insert cell
md `### End -- The following section contains the libraries import. Please ignore`
Insert cell
import {checkbox, text, select} from '@jashkenas/inputs'
Insert cell
lodash = require("lodash")
Insert cell
input = new Uint8Array(await Files.buffer(binary));
Insert cell
wb = xlsx.read(input, {type: 'array'});
Insert cell
as_json = xlsx.utils.sheet_to_json(ws)
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