Advertisement
oscarviedma

Código para Sincronizar Google Sheet con Grid.js - Tablas

Apr 8th, 2024
564
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1. <link href="https://cdn.jsdelivr.net/npm/gridjs/dist/theme/mermaid.min.css" rel="stylesheet" />
  2. <script src="https://cdn.jsdelivr.net/npm/gridjs/dist/gridjs.umd.js"></script>
  3.  
  4. <script>
  5. fetch('URL_DE_TU_SCRIPT?sheet=Tabla+1')
  6. .then(response => response.json())
  7. .then(data => {
  8. const headers = data.shift();
  9.  
  10. new gridjs.Grid({
  11. search: true,
  12. sort: true,
  13. columns: headers,
  14. data: data,
  15. pagination: {
  16. limit: 6,
  17. summary: true
  18. },
  19. style: {
  20. th: {
  21. background: '#617be5',
  22. 'font-weight': 'bold',
  23. color: '#fff',
  24. height: '60px'
  25. },
  26. td: {
  27. border: '1px solid #e9e9f6',
  28. background: '#fff',
  29. height: '40px'
  30. },
  31. table: {
  32. 'font-size': '15px',
  33. border: 'none',
  34. color: '#20355a'
  35. }
  36. },
  37. language: {
  38. 'search': {
  39. 'placeholder': '🔍 Buscar por palabra clave...'
  40. },
  41. 'pagination': {
  42. 'previous': 'Anterior',
  43. 'next': 'Siguiente',
  44. 'showing': 'Mostrando',
  45. 'results': () => 'Resultados',
  46. 'to': () => 'de',
  47. 'of': () => 'de'
  48. }
  49. }
  50. }).render(document.getElementById("ov-tabla-1"));
  51. });
  52. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement