Spaces:
Sleeping
Sleeping
Upload tools.py
Browse files
tools.py
CHANGED
@@ -37,12 +37,17 @@ class ExcelLoaderTool(Tool):
|
|
37 |
Read .xlsx/.xls/.csv from disk and return rows as a list of dictionaries with string keys.
|
38 |
"""
|
39 |
inputs = {
|
40 |
-
"path": {
|
|
|
|
|
|
|
|
|
41 |
"sheet": {
|
42 |
"type": "string",
|
43 |
"description": "Sheet name or index (optional, required for Excel files only)",
|
44 |
"required": False,
|
45 |
"default": "",
|
|
|
46 |
}
|
47 |
}
|
48 |
output_type = "array"
|
@@ -52,7 +57,7 @@ class ExcelLoaderTool(Tool):
|
|
52 |
if not os.path.isfile(path):
|
53 |
raise FileNotFoundError(path)
|
54 |
ext = os.path.splitext(path)[1].lower()
|
55 |
-
|
56 |
if sheet == "":
|
57 |
sheet = None
|
58 |
if ext == ".csv":
|
|
|
37 |
Read .xlsx/.xls/.csv from disk and return rows as a list of dictionaries with string keys.
|
38 |
"""
|
39 |
inputs = {
|
40 |
+
"path": {
|
41 |
+
"type": "string",
|
42 |
+
"description": "Path to .csv/.xls/.xlsx file",
|
43 |
+
"required": True
|
44 |
+
},
|
45 |
"sheet": {
|
46 |
"type": "string",
|
47 |
"description": "Sheet name or index (optional, required for Excel files only)",
|
48 |
"required": False,
|
49 |
"default": "",
|
50 |
+
"nullable": True
|
51 |
}
|
52 |
}
|
53 |
output_type = "array"
|
|
|
57 |
if not os.path.isfile(path):
|
58 |
raise FileNotFoundError(path)
|
59 |
ext = os.path.splitext(path)[1].lower()
|
60 |
+
# Handle empty string as None for sheet
|
61 |
if sheet == "":
|
62 |
sheet = None
|
63 |
if ext == ".csv":
|