Spaces:
Sleeping
Sleeping
File size: 753 Bytes
8b13cc0 5d59983 8b13cc0 37ecefa | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | import gradio as gr
import pandas as pd
import json
def excel_to_json(file):
# エクセルファイルを読み込み
df = pd.read_excel(file)
# C列の2行目以降の値を取得
column_values = df.iloc[1:, 2].tolist()
# JSON形式に変換
json_result = json.dumps(column_values, ensure_ascii=False, indent=2)
return json_result
# Gradioインターフェースの設定
interface = gr.Interface(
fn=excel_to_json,
inputs=gr.File(label="Upload Excel File"),
outputs=gr.Textbox(label="JSON Output"),
title="Excel to JSON Converter",
description="Upload an Excel file and get JSON output of column C values from the second row onward."
)
# Gradioアプリの実行
interface.launch()
|