What I’m trying to do:
I’m trying to follow the following tutorial
What I’ve tried and what’s not working:
I think I’ve followed the directions on the tutorial page but the data table is NOT populating data from the Excel. When I check and refresh the data table it’s empty.
Code Sample:
# this is a formatted code snippet from the Server.
import anvil.tables as tables
import anvil.tables.query as q
from anvil.tables import app_tables
import anvil.files
from anvil.files import data_files
import anvil.server
import pandas as pd
# This is the code to read a data file from the database data table.
# Reference Files, Media and Binary Data
## Data Files
### Quickstart: Data Files
# dependency is from anvil.files import data_files
import anvil.server
anvil.server.connect("server_QUEM43IT3ML2UMXCFLTBARFT-4UZACXYUFGJ7LPVX")
def import_excel_data(file):
with open(file, "rb") as f:
df = pd.read_excel(f)
for d in df.to_dict(orient="records"):
# d is now a dict of {columnname -> value} for this row
# We use Python's **kwargs syntax to pass the whole dict as
# keyword arguments
app_tables.chillerPoints.add_row(**d)
import_excel_data("Chillers Points List.xlsx")
# paste your code between ```
Clone link:
share a copy of your app