sewoza
sewoza•2mo ago

Taking in excel spreadsheets

Hi everyone, I'm fairly new to the tech space and as a project from my professor. We were tasked with using windmill to take in an xIsx file, do the data preprocessing and generate outputs. And then create an app that would allow us to plug in different excel files. Then under go the same preprocessing and visualise outputs. Usually I would do this with Jupyter notebooks. I am having a little bit of trouble trying to navigate windmill, it's a little overwhelming for a beginner. I was wondering if anyone could spare some time to help me/ point me in the right direction. Thanks so much for your time!
2 Replies
Shenanigans
Shenanigans•2w ago
I am pursing a similar project my self but with a csv file instead. I will assume you have used the platform and are somewhat comfortable with its interface. 1. Create a script using your preferred language of choice(I used Typescript - Bun). Navigate to Settings -> Generated UI, then change its input to string. Under Field settings, select File. Windmill passes your files as a base64 encoded string. There are sources online that can help with serializing the string. Once you have your serialized string, you will need to parse it. I used csvtojson (Note: set your output to json) 2. Create an app with a button and connect your script to the button. You will also need to add a File Input component for the user to upload their csv file. Connect the result/data of this file to the button as well as other required inputs then add an AgGrid Table for visualization. If performance is an issue you can run a for loop step in your flow and iterate over your data in parallel. You can also call said flow in your script via importing the windmill package and adding the following(or similar in your prefered language) await wmill.runFlow('f/myFlow/path-to-flow',{json}). You may also use a branch step for more control over your data validation. Here is some more info on utilizing the editor. Here is a video by the windmill team that may help. Hope this helps. Goodluck. 🙂
MojoAuth
A Deep Dive into Base64 with TypeScript
Learn how to efficiently encode and decode Base64 in TypeScript with easy examples and practical tips for your web applications.
AgGrid table | Windmill
The AgGrid table component allows you to display an Ag Grid table.
Runnable editor | Windmill
The strength of Windmill's app editor is the ability to connect everything together:
Windmill
YouTube
App Editor Tutorial
Get started with Windmill: https://www.windmill.dev/ Docs: https://www.windmill.dev/docs/intro Repo: https://github.com/windmill-labs/windmill Blog: https://www.windmill.dev/blog 00:00 AgGrid 03:51 Select Component 05:34 Dynamically Connect Components 08:21 Slider Component 10:15 Button & Styling 11:15 Evals 13:34 Share Recipe Use Case 18:36 Dy...
npm
csvtojson
A tool concentrating on converting csv data to JSON with customised parser supporting. Latest version: 2.0.10, last published: 6 years ago. Start using csvtojson in your project by running npm i csvtojson. There are 1391 other projects in the npm registry using csvtojson.
Zach
Zach•2w ago
Since you’re a Python user, something like the following might help you get off the ground:
import pandas as pd
import io

def main(excel: bytes, sheet_name: str = None):
"""
Read specific sheet from Excel file with options.

Args:
excel: The Excel file as bytes
sheet_name: Optional sheet name (defaults to first sheet)

Returns:
Processed Excel data
"""
excel_buffer = io.BytesIO(excel)

# Read specific sheet or first sheet
df = pd.read_excel(excel_buffer, sheet_name=sheet_name or 0)

# Example processing: get summary statistics
summary = {
"rows": len(df),
"columns": len(df.columns),
"column_names": df.columns.tolist(),
"data_preview": df.head(10).to_dict(orient='records'),
"numeric_summary": df.describe().to_dict() if df.select_dtypes(include='number').shape[1] > 0 else None
}

return summary
import pandas as pd
import io

def main(excel: bytes, sheet_name: str = None):
"""
Read specific sheet from Excel file with options.

Args:
excel: The Excel file as bytes
sheet_name: Optional sheet name (defaults to first sheet)

Returns:
Processed Excel data
"""
excel_buffer = io.BytesIO(excel)

# Read specific sheet or first sheet
df = pd.read_excel(excel_buffer, sheet_name=sheet_name or 0)

# Example processing: get summary statistics
summary = {
"rows": len(df),
"columns": len(df.columns),
"column_names": df.columns.tolist(),
"data_preview": df.head(10).to_dict(orient='records'),
"numeric_summary": df.describe().to_dict() if df.select_dtypes(include='number').shape[1] > 0 else None
}

return summary

Did you find this page helpful?