Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

203
Visualizações
Pyodide unable to read xlsx files into pandas

I'm trying to load xlsx files using pyodide. I able to load xls files correctly using the following code:

response = await fetch('${fileUrl}')
js_buffer = await response.arrayBuffer()
dFrame = pd.read_excel(BytesIO(js_buffer.to_py()))

However, it fails when I try to pass an xlsx file. I am not sure what's causing it. Here are potential issues that I already struck-out after testing:

  1. "openpyxl" not properly loaded - I used micropip to load openpyxl, and pd.read_excel('filename.xlsx') works when I manually place a valid xlsx file in the memory. So this isn't the issue.

Thanks for the help.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

So, I'm still not sure why directly read_excel or Excelfile functions don't work (especially since they just call openpyxl anyway), but I was able to get it to work by opening the file using openpyxl and then converting it to a dataframe. Working code below:

      response = await fetch('${fileUrl}')
      js_buffer = await response.arrayBuffer()
      wb = openpyxl.load_workbook(BytesIO(js_buffer.to_py()), data_only = True)
      ws = wb.worksheets[0]
      excel_data = ws.values
      columns = next(excel_data)[0:]
      dFrame = pd.DataFrame(excel_data , columns=columns)
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda