Import utf-8 encoded excel

Hi @Sweezy,

Have you tried something based on the code in this post? Importing from Excel - #2

I’m able to upload a UTF-8 encoded CSV with the following code (adapted from the above post):

import pandas as pd
import random

@anvil.server.callable
def add_table(media):
  tmp_name = "/tmp/%s" % "".join([random.choice("0123456789abcdef") for x in range(32)])
  with open(tmp_name, 'wb') as f:
    f.write(media.get_bytes())

  df = pd.read_csv(tmp_name)
  for d in df.to_dict(orient="records"):
      app_tables.my_table.add_row(**d)
1 Like