I’m trying the Uplink script method since I do have some data processing and don’t need a reusable uploading capability. I’m getting this error message:
AnvilSerializationError: Cannot serialize return value from function. Value must be JSON serializable
at Form1, line 13
Here’s what I’m trying on the Anvil side:
from anvil import *
from tables import app_tables
import anvil.server
class Form1(Form1Template):
def __init__(self, **properties):
# You must call self.init_components() before doing anything else in this function
self.init_components(**properties)
# Any code you write here will run when the form opens.
#
input = anvil.server.call("import_row", 0)
print(input)
print("Hello World!")
# Add row from excel file to Data Table
app_tables.data_table1.add_row(input)
And here’s what I have on the “server” side (my computer):
# This is a simple program using Anvil Uplink to serve
# an Excel file from my hard disk.
import pandas as pd
import numpy as np
import anvil.server
# Create data frame for Excel file, which is a basic spreadsheet of 26 columns and 26,000 rows
df = pd.read_excel('../normalized_DB.xlsx', header=0)
@anvil.server.callable
def import_row(row_num):
return(df.loc[row_num])
anvil.server.connect("[key]")
anvil.server.wait_forever()
Ultimately, I’d like to iterate over all the rows and get them into the Data Table, but I’m just trying to get the first row working here. Do I need to convert the data to JSON? Is there any way to keep it simple and avoid that step?