First Commit

This commit is contained in:
2026-03-10 22:29:56 -04:00
commit c4977e4b5e
22 changed files with 5947 additions and 0 deletions

25
src/utils/excelParser.js Normal file
View File

@ -0,0 +1,25 @@
import * as XLSX from 'xlsx';
export const loadItemsFromExcel = async () => {
try {
const response = await fetch(`/items.xlsx?t=${new Date().getTime()}`);
if (!response.ok) {
throw new Error('Failed to load excel file');
}
const arrayBuffer = await response.arrayBuffer();
const workbook = XLSX.read(arrayBuffer, { type: 'array' });
// Assuming the items are in the first sheet
const firstSheetName = workbook.SheetNames[0];
const worksheet = workbook.Sheets[firstSheetName];
// Convert sheet to JSON
const data = XLSX.utils.sheet_to_json(worksheet);
// We expect the data to have columns like 'Item ID', 'Description', 'Price'
return data;
} catch (error) {
console.error("Error loading Excel items:", error);
return [];
}
};