From 71ef957c79c30f864ede5875ecff0a3a8ec6a418 Mon Sep 17 00:00:00 2001 From: Milind Soni <46266943+milind-soni@users.noreply.github.com> Date: Thu, 4 Sep 2025 03:55:06 +0530 Subject: [PATCH 1/3] Added Excel Read Template Added Excel Reading template so that it is able to read excel correctly It also prints the available sheets in the excel file and defaults to opening the first sheet in the excel always Need to add this as AI diverts to some other libraries to open excel file --- llms/BuildCodePrompt.txt | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/llms/BuildCodePrompt.txt b/llms/BuildCodePrompt.txt index e62ce329..2f45b1a2 100644 --- a/llms/BuildCodePrompt.txt +++ b/llms/BuildCodePrompt.txt @@ -19,6 +19,17 @@ def udf(path: str='s3://fused-sample/demo_data/table/US_states.geojson'): states = gpd.read_file(path) return states +Excel Sheet (default to the first sheet) +@fused.udf +def udf(path: str = "s3://fused-sample/demo_data/housing_2024.xlsx"): + import pandas as pd + xls = pd.ExcelFile(path, engine="openpyxl") + print("Available sheets", xls.sheet_names) + df = pd.read_excel(xls, sheet_name=0) + print(df.head()) + return df + + HTML: Return HTML using the the following generic HTML UDF format (i.e. use common = fused.laod() + return common.html_to_obj(html_content)) even when making altair charts : From 2d5d508931f9e3c8d36d29f86bc42fc7a7847940 Mon Sep 17 00:00:00 2001 From: Milind Soni <46266943+milind-soni@users.noreply.github.com> Date: Thu, 4 Sep 2025 03:55:42 +0530 Subject: [PATCH 2/3] Update BuildCodePrompt.txt --- llms/BuildCodePrompt.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/llms/BuildCodePrompt.txt b/llms/BuildCodePrompt.txt index 2f45b1a2..29582d90 100644 --- a/llms/BuildCodePrompt.txt +++ b/llms/BuildCodePrompt.txt @@ -26,7 +26,6 @@ def udf(path: str = "s3://fused-sample/demo_data/housing_2024.xlsx"): xls = pd.ExcelFile(path, engine="openpyxl") print("Available sheets", xls.sheet_names) df = pd.read_excel(xls, sheet_name=0) - print(df.head()) return df From 63ae0b879013da22a970d9592b7002b515b81cb4 Mon Sep 17 00:00:00 2001 From: Milind Soni <46266943+milind-soni@users.noreply.github.com> Date: Thu, 4 Sep 2025 16:10:04 +0530 Subject: [PATCH 3/3] Update BuildCodePrompt.txt --- llms/BuildCodePrompt.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/llms/BuildCodePrompt.txt b/llms/BuildCodePrompt.txt index 29582d90..e81da665 100644 --- a/llms/BuildCodePrompt.txt +++ b/llms/BuildCodePrompt.txt @@ -19,13 +19,13 @@ def udf(path: str='s3://fused-sample/demo_data/table/US_states.geojson'): states = gpd.read_file(path) return states -Excel Sheet (default to the first sheet) +Excel Sheet (default to the first sheet, and set header to None) @fused.udf def udf(path: str = "s3://fused-sample/demo_data/housing_2024.xlsx"): import pandas as pd xls = pd.ExcelFile(path, engine="openpyxl") print("Available sheets", xls.sheet_names) - df = pd.read_excel(xls, sheet_name=0) + df = pd.read_excel(xls, sheet_name=0, header=None) return df