Public
Edited
Jul 23, 2023
Insert cell
Insert cell
Insert cell
// sheetname = "SR Legacy and FNDDS"
sheetname = workbook.sheetNames[0]
Insert cell
data_raw = workbook.sheet(sheetname)
Insert cell
columns = Object.values(data_raw[3])
Insert cell
data_unprepared = data_raw.slice(4)
Insert cell
data = {
const newArray = [];
for (let i = 0; i < data_unprepared.length; ++i) {
const oldObject = data_unprepared[i];
const newKeys = Object.values(data_raw[3]);
const newObject = {};
newKeys.forEach((newKey, index) => {
const oldKey = Object.keys(oldObject)[index];
newObject[newKey] = oldObject[oldKey];
});
newArray.push(newObject);
}
return newArray;
}
Insert cell
Insert cell
myList = new Set()
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
//170001 170000 172421 171413 175158
update_myList_from(
set_from_data(data, [170001, 170000, 172421, 171413, 175158])
)
Insert cell
Insert cell
macros = ["Protein", "Fat", "Calories", "Carbohydrate", "Sugars", "Fiber", "Saturated Fats", ]
Insert cell
Object.keys(data[0])
Insert cell
Insert cell
Insert cell
adjust_portion = (ingredient, ing_qty) => {
}
Insert cell
Insert cell
Insert cell
{
add;
for (let index = 0; index < sel.length; ++index) {
myList.add(sel[index]);
}
}
Insert cell
{
clearList;
myList.clear();
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
//my selected list
myList
Insert cell
// remove_from_myList(myList, "Onions")
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