This tool generates XLSForm files using AI and converts them to JSON format using the formconv service.
- Generates valid XLSForm files with proper structure using AI
- Handles survey, choices, and settings sheets
- Avoids conversion issues by not using complex constraints
- Automatically converts XLSX to JSON format with timestamped filenames
- Handles file path issues with the excel-mcp-server
- Uses environment variables for configuration
- Generates timestamped filenames to avoid overwriting previous results
- All generated files are saved in the
output_filesdirectory - Available as both a command-line script and a web API
- Provides a Gradio web interface for easy interaction
- The user provides a description of the survey they want to create
- The tool uses an LLM (through smolagents) to generate a proper XLSForm structure
- The XLSForm is created using the excel-mcp-server
- The XLSForm is then converted to JSON using the formconv service
The tool uses the following environment variables, which should be set in a .env file:
DEEPINFRA_API_KEY: Your DeepInfra API key (optional but recommended)MODEL_ID: The model ID to use (defaults todeepinfra/Qwen/Qwen3-Next-80B-A3B-Instruct)
Example .env file:
DEEPINFRA_API_KEY=your_api_key_here
MODEL_ID=deepinfra/Qwen/Qwen3-Next-80B-A3B-InstructFiles are saved with timestamped names to avoid conflicts in the output_files directory:
- XLSForm files:
output_files/xlsform_survey_YYYYMMDD_HHMMSS.xlsx - JSON result files:
output_files/form_result_YYYYMMDD_HHMMSS.json
python main.py "Create a survey to collect user feedback with name, email, rating (1-5), and comments fields"- Start the Flask server:
python app.py- Send a POST request to
/responseAI.json:
curl -X POST http://localhost:5000/responseAI.json \
-H "Content-Type: application/json" \
-d '{"query": "Create a survey to collect user feedback with name, email, rating (1-5), and comments fields"}'- Start the Flask server (required for the Gradio interface):
python app.py- In a separate terminal, start the Gradio interface:
python interface.py- Open your browser and navigate to
http://localhost:7860
The Gradio interface provides a user-friendly way to generate surveys:
- Enter your survey requirements in natural language
- Click "Generate Survey"
- Download the generated XLSX and JSON files
- Python 3.8+
- smolagents
- excel-mcp-server (installed via uvx)
- requests
- pandas
- flask
- gradio
pip install -r requirements.txtpython main.py "Create a medical clinic survey to collect patient information including name, age, gender, symptoms, and preferred treatment. Include a rating question for overall satisfaction."This will generate an XLSForm file and convert it to JSON format, saving both files in the output_files directory with timestamped filenames.
curl -X POST http://localhost:5000/responseAI.json \
-H "Content-Type: application/json" \
-d '{"query": "Create a medical clinic survey to collect patient information including name, age, gender, symptoms, and preferred treatment. Include a rating question for overall satisfaction."}'This will return the generated JSON form in the response.
main.py: Command-line interfaceapp.py: Flask web APIinterface.py: Gradio web interfaceformconv/: Core functionality as a Python packagexlsform_prompt.txt: Prompt template for XLSForm generationoutput_files/: Directory where generated files are saved