Import error: excel to Data table

Hi,

I am trying to import an excel file to Data table, but I am having constantly this error:

anvil.tables.TableError: Column ‘Data_fattura’ is a date - cannot set it to a datetime

The excel file does not contain time in the date, I checked also putting formula to remove timestamp.


What is the correct format to allow import the date in Anvil Data table?

I am using this code with Uplink:

@anvil.server.callable
def store_data(file):
  with open(file.name, "rb") as f:
    df = pd.read_excel(f)
    for d in df.to_dict(orient="records"):
      app_tables.input.add_row(**d)

Thanks

You might want to check out search terms related to

pandas datetime to date

e.g.

How to Convert Datetime to Date in Pandas - Statology

python pandas date time conversion to date - Stack Overflow

it looks like you need to do something like

df['Data_fattura'] = df['Data_fattura'].dt.date
1 Like