Exportar Tablas HTML a Excel (con ExcelJS + Observer)

Agrega un botón a cada tabla HTML para exportarla a Excel usando ExcelJS

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey, Greasemonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

ผู้เขียน
Jairo Abraham Bernal Villanueva
จำนวนติดตั้งประจำวัน
0
จำนวนติดตั้งทั้งหมด
1
คะแนน
0 0 0
เวอร์ชัน
1.2
สร้างเมื่อ
09-05-2025
อัปเดตเมื่อ
09-05-2025
Size
4.63 กิโลไบต์
สัญญาอนุญาต
MIT
ปรับใช้กับ
ไซต์ทั้งหมด

Exportar Tablas HTML a Excel (Greasemonkey/Tampermonkey Script)

Este script de usuario detecta automáticamente todas las tablas HTML visibles en cualquier página web y agrega un botón flotante a cada una para exportarla como archivo .xlsx, utilizando ExcelJS.

✨ Características

  • Botón de exportación individual para cada tabla
  • Soporte completo para celdas fusionadas (rowspan, colspan)
  • Exportación directa como archivo .xlsx
  • No requiere configuración ni interacción con el código del sitio
  • Compatible con sitios que renderizan contenido dinámicamente (React, Angular, etc.)
  • Registro limpio en consola para depuración (console.clear() y console.log())

🧠 Cómo funciona

  • Usa MutationObserver para detectar tablas aunque se agreguen dinámicamente al DOM
  • Añade un botón discreto en la esquina superior derecha de cada tabla visible
  • Genera un archivo .xlsx usando la biblioteca ExcelJS

📦 Tecnologías

📥 Instalación

  1. Instala Tampermonkey en tu navegador.
  2. Haz clic en este enlace para instalar el script:
    👉 Exportar Tablas HTML a Excel
  3. Navega cualquier sitio con tablas. Verás un botón 📥 sobre cada tabla.

🛡 Seguridad

Este script:

  • No recopila ni transmite datos
  • No accede a servidores externos (salvo para cargar ExcelJS desde CDN)
  • No modifica el contenido original de la página, solo lo lee y complementa

🧪 Ejemplos de uso

  • Paneles de control empresariales
  • Sistemas ERP o CRM sin función de exportación
  • Portales académicos, gubernamentales o internos