xlsform
Authoring data collection forms in Excel for mobile surveys. XLSForm converts Excel files to XForms for ODK, KoBoToolbox, and similar platforms. Use for field surveys, data collection, conditional forms, GPS tracking, and offline data gathering.
$ Installieren
git clone https://github.com/majiayu000/claude-skill-registry /tmp/claude-skill-registry && cp -r /tmp/claude-skill-registry/skills/data/xlsform ~/.claude/skills/claude-skill-registry// tip: Run this command in your terminal to install the skill
name: xlsform description: Authoring data collection forms in Excel for mobile surveys. XLSForm converts Excel files to XForms for ODK, KoBoToolbox, and similar platforms. Use for field surveys, data collection, conditional forms, GPS tracking, and offline data gathering.
XLSForm Skill
What is XLSForm?
XLSForm is a simple, human-friendly form standard that lets you design data collection forms in Excel. Your forms convert to XForm (XML) and work with mobile platforms like ODK Collect, KoBoToolbox, SurveyCTO, and Enketo. Perfect for surveys, GPS tracking, offline data gathering, and complex conditional logic.
Five Key Concepts
- Survey Sheet - Lists your questions (type, name, label). One row per question.
- Choices Sheet - Defines answer options for select_one and select_multiple questions.
- Question Types - 20+ types: text, integer, select_one, geopoint, image, date, calculate, and more.
- Skip Logic - The
relevantcolumn shows/hides questions based on previous answers. - Calculations - The
calculatequestion type andcalculationcolumn compute derived values.
Minimal Working Example
Survey Sheet:
| type | name | label |
|---|---|---|
| text | respondent_name | What is your name? |
| integer | age | How old are you? |
| select_one yes_no | consent | Do you agree? |
| calculate | timestamp | now() |
Choices Sheet:
| list_name | name | label |
|---|---|---|
| yes_no | yes | Yes |
| yes_no | no | No |
This creates a 3-question form with a hidden timestamp calculation.
Essential Constraints
| Aspect | Limit | Note |
|---|---|---|
| Question name | 255 chars | Alphanumeric + underscore only |
| Label/hint | No hard limit | Practical: keep under 500 chars |
| Choices per list | No hard limit | ~100+ works well |
| Calculation expression | ~2000 chars | Complex expressions may slow form |
| Form size | No hard limit | Very large forms (500+ questions) may be slow |
| Languages | Unlimited | Use label::language, hint::language syntax |
Core Reference Files
Detailed documentation organized by topic:
Form Structure:
- survey-sheet.md - Survey worksheet columns and structure
- choices-sheet.md - Multiple-choice list structure
- settings-sheet.md - Form metadata and settings
Questions & Types:
- question-types.md - All 20+ question types with examples
Logic & Calculations:
- skip-logic.md - Conditional display with
relevant - calculations.md -
calculatetype andcalculationcolumn - constraints.md - Validation rules with
constraintcolumn - xpath-expressions.md - XPath functions for expressions
Advanced Features:
- cascading-selects.md - Dependent choice lists
- appearances.md - Widget customization
- external-data.md - Load choices from CSV/XML files
- multilingual.md - Multiple language support
Best Practices & Troubleshooting:
- best-practices.md - Design patterns and recommendations
- common-errors.md - Error messages and fixes
Navigation:
- TABLE_OF_CONTENTS.md - Find docs by topic, use case, or question type
Examples
See examples.md for 6 complete, working XLSForms:
- Basic Survey - Simple questions (text, integer, select_one)
- Conditional Logic - Skip logic with relevant
- Calculations & Validation - Constraints and calculated fields
- GPS & Media - Location tracking and photo capture
- Multilingual Form - Multiple languages
- Advanced Features - Repeat groups, cascading selects, external data
Common Tasks
Generate an XLSForm Excel file
When asked to create an XLSForm, output a properly structured Excel file (.xlsx):
Required worksheets:
- survey - Question definitions (type, name, label columns required)
- choices - Choice lists for select questions (list_name, name, label required)
- settings - Optional form metadata (form_title, form_id, version)
Format:
- Use clear tabular markdown showing each worksheet
- Include all required columns (type, name, label)
- Add optional columns as needed (hint, relevant, constraint, etc.)
- Users can copy tables into Excel, or use
scripts/create_xlsform.pyto generate .xlsx from CSV
Example output structure:
# survey worksheet
| type | name | label | hint |
|------|------|-------|------|
| ... | ... | ... | ... |
# choices worksheet
| list_name | name | label |
|-----------|------|-------|
| ... | ... | ... |
# settings worksheet (optional)
| form_title | form_id | version |
|------------|---------|---------|
| ... | ... | ... |
See creating-xlsforms.md for detailed instructions on generating forms.
Create a simple survey
- Read this quick start and the minimal example above
- Check question-types.md for basic types
- Look at "Basic Survey" example in examples.md
- Use
python scripts/validate_xlsform.py form.xlsxto check structure
Add conditional questions
- Read skip-logic.md
- Look at "Conditional Logic" example in examples.md
- Use
relevantcolumn with XPath expressions - Examples:
${age} >= 18,selected(${previous_answer}, 'option')
Add calculations
- Read calculations.md
- Examples: sum, average, string concatenation, date arithmetic
- Use
calculatequestion type for hidden computed values - Use
calculationcolumn for visible computed fields
Validate before using
python scripts/validate_xlsform.py form.xlsx # Check Excel structure
python scripts/convert_to_xform.py form.xlsx # Convert and validate XForm output
Deploy to ODK Collect or KoBoToolbox
- Run validation scripts to ensure no errors
- Upload .xlsx to platform or convert to .xml first
- Test on mobile device before deployment
- Check best-practices.md for field readiness
Best Practices Summary
Form Design:
- Keep labels clear and concise (questions, not statements)
- Test on mobile devices early—forms look different on small screens
- Use hints for clarification, not required instructions
- Order questions logically; use skip logic instead of long forms
Performance:
- Avoid complex nested calculations
- Use choice lists instead of free text when possible
- Limit repeat groups to reasonable counts (50+)
- Test on older devices
Validation:
- Always run
validate_xlsform.pybefore conversion - Use constraints for user-facing validation, not just data cleaning
- Add
constraint_messageto tell users why an answer is invalid - Test edge cases: empty inputs, extreme values, rapid skips
Multilingual Forms:
- Use
label::Englishandlabel::Frenchsyntax - All languages in one cell (one column per language)
- Test right-to-left languages on mobile
See best-practices.md for detailed patterns and recommendations.
Troubleshooting
Parse errors when converting?
- Run
validate_xlsform.pyfirst—it catches structural issues early - Check common-errors.md for error-specific solutions
- Ensure question
namefields are alphanumeric + underscore only
Form displays wrong on mobile?
- Check question-types.md for type-specific appearances
- Use
appearancecolumn to customize widgets - Test on actual mobile device—online converters may not match deployed forms
Calculations not working?
- Check xpath-expressions.md for function reference
- Verify referenced question names match exactly (case-sensitive)
- Use
${variable_name}syntax inside expressions
Choice lists not showing?
- Ensure
list_namein survey matcheslist_namein choices sheet (case-sensitive) - Run
validate_xlsform.pyto verify all references
See common-errors.md for a comprehensive troubleshooting guide.
Version Information
XLSForm syntax evolves but maintains backward compatibility. Most forms work across versions 4.0–7.1+. Check TABLE_OF_CONTENTS.md for version-specific features.
Getting Help
- Quick questions? Check TABLE_OF_CONTENTS.md to find relevant docs
- See working examples? Look at examples.md
- Stuck on a feature? Search reference/ by topic
- Validation scripts not working? See error message at bottom of script output
Next Steps
- Start simple: Create a basic form using the minimal example above
- Validate: Run
validate_xlsform.pyto check structure - Learn by example: Read examples.md for patterns you need
- Go deeper: Read specific reference/ docs for advanced features
- Deploy: Test thoroughly on mobile before using in production
Repository
