Exportar Tablas HTML a Excel (con ExcelJS + Observer)

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

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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
Памер
4.6 КБ
Ліцэнзія
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