Sign InSign Up

Rocketbot Forum

Rocketbot Forum Logo Rocketbot Forum Logo

Rocketbot Forum Navigation

  • Academy Rocketbot
  • Tutorials
  • Documentación
Search
Ask A Question

Mobile menu

Close
  • Home
  • Popular
  • Categories
  • Tags
  • Questions
    • New Questions
    • Most voted
    • Most visited
    • Most Responded
  • Academy Rocketbot
  • Tutorials
  • Documentación
Home/ Questions/Q 17067
Next
Answered

Rocketbot Forum Latest Questions

Dylann34
  • 0
  • 0
Dylann34
Asked: June 21, 20242024-06-21T12:56:13+00:00 2024-06-21T12:56:13+00:00In: Comandos

Ayuda para generar un correo en base a un Array

  • 0
  • 0

Hola RPA’Lovers!! Estoy desarrollando un rpa que obtiene un Excel desde GoogleDrive, luego manipula los datos y esto retorna un array Datos: [{’04-03-2024′, ‘41985’}, {’04-03-2024′, ‘41985’}, {’15-02-2024′, ‘4400025519’}, {’15-02-2024′, ‘4400025519’}, {’15-02-2024′, ‘4400025519’}].

Estos datos quiero utilizarlos para rellenar una table html de forma dinámica en base a cuantos datos vengan en el array Datos. Mi problema lo tengo aquí al tratar de añadir las filas a la table. Utilizo un Execute Python para lograrlo, mi código es el siguiente:

datos = GetVar(«Datos»)

# Datos de ejemplo (lista de diccionarios)
# datos = [
# {‘OC’: ‘123’, ‘Fecha’: «18-06-2024»},
# {‘OC’: ‘321’, ‘Fecha’: «18-06-2024»},
# {‘OC’: ‘542’, ‘Fecha’: «18-06-2024»},
# {‘OC’: ‘542’, ‘Fecha’: «18-06-2024»},
# {‘OC’: ‘542’, ‘Fecha’: «18-06-2024»}
#]

# Construir la estructura de la tabla HTML
html = «<table>\n»
html += «<thead><tr><th>OC</th><th>Fecha</th></tr></thead>\n»
html += «<tbody>\n»

# Iterar sobre los datos y añadir filas a la tabla
for dato in datos:
html += «<tr>»
html += f»<td>{dato[1]}</td>»
html += f»<td>{dato[0]}</td>»
html += «</tr>\n»

html += «</tbody>\n»
html += «</table>»

SetVar(«html», html)

El problema es que me retorna: String Index out of range.
Alguno le pasó/pasa esto? Como lo solucionaron o que me recomiendan? Quedo atento, un abrazo!

execute python
2
  • 2 2 Answers
  • 3k Views
  • 0 Followers
  • 0
Share
  • Facebook

    2 Answers

    • Voted
    • Oldest
    • Recent
    1. Bumblebee
      Best Answer
      Bumblebee
      2024-06-21T13:44:56+00:00Added an answer on June 21, 2024 at 1:44 pm

      Hola Dylan, puedes usar el comando ‘Lista a Tabla HTML’ del módulo HTML que realiza la conversión que necesitas.
      Saludos!

        • 0
      • Reply
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
        • Share on LinkedIn
        • Share on WhatsApp
    2. Dylann34
      Dylann34
      2024-06-21T14:29:19+00:00Added an answer on June 21, 2024 at 2:29 pm
      Ayuda para generar un correo en base a un Array

      Gracias. Bee!
      Me funcionó para crear la lista de forma dinámica en base al Array!

      Estuve bastante estresado tratando de hacerlo mediante Python, ya que no conocía que existía ya el Modulo HTML. Te agradezco tu pronta respuesta.

        • 0
      • Reply
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
        • Share on LinkedIn
        • Share on WhatsApp

    Leave an answer
    Cancel reply

    You must login to add an answer.


    Forgot Password?

    Need An Account, Sign Up Here

    Sidebar

    Ask A Question

    Stats

    • Questions : 1k
    • Answers : 2k
    • Posts : 0
    • Comments : 0
    • Best Answers : 163
    • Users : 5k
    • Popular
    • Comments
    • Tags

    Related Questions

      • Answers: 0

      Obtener URL actual PDF en nueva pestaña

      • Answers: 0

      Obtener URL actual PDF en nueva pestaña

      • Answers: 3

      Problema con typing_extensions al usar EasyOCR en RocketBot

      • Answer: 1

      Error al importar una libreria python

      • Answers: 3

      ¿Como pego unos valores en las casillas de color rojo? ...

    Users

    Explore

    • Home
    • Popular
    • Categories
    • Tags
    • Questions
      • New Questions
      • Most voted
      • Most visited
      • Most Responded

    Footer

    rocketbot white

    Rocketbot SpA | Todos los derechos reservados 2018 - 2020

    © 2020 Discy. All Rights Reserved
    With Love by 2code.

    en_US
    es_ES en_US

    Insert/edit link

    Enter the destination URL

    Or link to existing content

      No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.