Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/sergio-salcedo-dev/excel-product-manager/llms.txt

Use this file to discover all available pages before exploring further.

Preoc Product Manager uses the xlsx library to read and write spreadsheet files, giving you a seamless bridge between the in-browser catalog and the spreadsheets your team already works with. You can import a bulk product list from any .xlsx or .xls file to instantly populate the catalog, and export your entire current catalog as a downloadable productos.xlsx file at any time — no server required.

Importing from Excel

To import products, click Importar Excel in the left sidebar. A native file picker opens — select any .xlsx or .xls file from your device. The file is read entirely in the browser via the FileReader API; nothing is uploaded to a server. ExcelService.parseExcel reads the first sheet of the workbook and maps each data row to a Product object. The parser accepts both English and Spanish column header names, making it easy to re-import files that were previously exported from Preoc (which uses Spanish headers) or prepared from scratch in English.

Expected Column Headers

FieldAccepted Header NamesNotes
idid, IDDefaults to prod-{Date.now()}-{index} if missing
codecode, Código, CodigoFalls back to empty string if absent
descriptiondescription, Descripción, DescripcionFalls back to empty string if absent
unitunit, UnidadDefaults to ud if missing
priceprice, PrecioParsed as parseFloat; defaults to 0
categorycategory, Categoría, CategoriaDefaults to General if missing

Sample Excel Layout

The table below shows what a correctly structured import sheet looks like:
CódigoDescripciónUnidadPrecioCategoría
MT-001Cemento Portland Tipo I - Saco 50kgsac9.50Materiales
MO-001Oficial de Primera - Horah24.50Mano de Obra
MQ-001Hormigonera Eléctrica 150L - Alquiler díadía12.00Maquinaria
IN-001Cable Cobre 2.5mm Libre Halógenos - 100mrol65.00Instalaciones
The ID column is optional — the importer generates a unique ID for any row where it is missing or blank.
Importing replaces the entire current catalog. All existing products in the browser are discarded and replaced with the rows from the imported file. Export your current catalog first if you need to preserve any existing products before importing a new file.
On a successful import, a green alert banner confirms: “Archivo procesado correctamente.” The view resets to page 1 of the newly imported catalog. If the file cannot be parsed (wrong format, corrupted file, etc.), a red error alert is shown instead: “Error al procesar el Excel. Asegúrese de que el formato sea correcto.”

ExcelService.parseExcel API

ExcelService.parseExcel(file: File): Promise<Product[]>
Accepts a File object (from an <input type="file"> change event) and returns a Promise that resolves with an array of Product objects. Internally it:
  1. Reads the file as an ArrayBuffer using FileReader.readAsArrayBuffer.
  2. Wraps the result in a Uint8Array and passes it to XLSX.read(data, { type: 'array' }) to parse the workbook.
  3. Targets workbook.SheetNames[0] — always the first sheet.
  4. Converts the sheet to a JSON array with XLSX.utils.sheet_to_json().
  5. Maps each row through the header-alias lookup table above, applying defaults where fields are missing.
The promise rejects if the file cannot be read or if XLSX.read() throws.

Exporting to Excel

To export your catalog, click Exportar Datos in the left sidebar. The browser immediately triggers a file download — no dialog or configuration needed. The exported file is named productos.xlsx by default and contains a single sheet called Productos. The export always includes all products currently in the catalog, not just the products visible on the current page.

Output Columns

The exported sheet uses Spanish column headers to match the accepted import aliases, enabling round-trip workflows:
Column HeaderSource FieldType
IDproduct.idString
Códigoproduct.codeString
Descripciónproduct.descriptionString
Unidadproduct.unitString
Precioproduct.priceNumber
Categoríaproduct.categoryString

ExcelService.exportToExcel API

ExcelService.exportToExcel(products: Product[], fileName: string = 'productos.xlsx'): void
Accepts the array of products to export and an optional file name (defaults to 'productos.xlsx'). Internally it:
  1. Maps the Product array to plain objects with the Spanish column headers shown above.
  2. Converts the array to a worksheet with XLSX.utils.json_to_sheet().
  3. Creates a new workbook with XLSX.utils.book_new() and appends the sheet as "Productos" using XLSX.utils.book_append_sheet().
  4. Triggers a browser download with XLSX.writeFile().
You can round-trip your data freely: click Exportar Datos to download the current catalog, edit prices or descriptions in Excel, then click Importar Excel to reload the updated file. The Spanish column headers (Código, Descripción, Categoría, etc.) produced by the exporter are all valid import aliases, so no reformatting is needed between export and re-import.

Build docs developers (and LLMs) love