-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
26 lines (21 loc) · 783 Bytes
/
script.js
File metadata and controls
26 lines (21 loc) · 783 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
async function loadCompanies() {
try {
const response = await fetch("companies.xlsx");
const arrayBuffer = await response.arrayBuffer();
const workbook = XLSX.read(arrayBuffer, { type: "array" });
const sheet = workbook.Sheets[workbook.SheetNames[0]];
const data = XLSX.utils.sheet_to_json(sheet);
// Store each company as lowercase key
data.forEach(row => {
const companyName = row["Company Name"];
if (companyName) {
const key = companyName.toLowerCase(); // lowercase key
localStorage.setItem(key, JSON.stringify(row));
}
});
console.log("Companies stored individually in localStorage (lowercase keys)");
} catch (err) {
console.error("Error reading companies.xlsx:", err);
}
}
loadCompanies();