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

  1. Survey Sheet - Lists your questions (type, name, label). One row per question.
  2. Choices Sheet - Defines answer options for select_one and select_multiple questions.
  3. Question Types - 20+ types: text, integer, select_one, geopoint, image, date, calculate, and more.
  4. Skip Logic - The relevant column shows/hides questions based on previous answers.
  5. Calculations - The calculate question type and calculation column compute derived values.

Minimal Working Example

Survey Sheet:

typenamelabel
textrespondent_nameWhat is your name?
integerageHow old are you?
select_one yes_noconsentDo you agree?
calculatetimestampnow()

Choices Sheet:

list_namenamelabel
yes_noyesYes
yes_nonoNo

This creates a 3-question form with a hidden timestamp calculation.

Essential Constraints

AspectLimitNote
Question name255 charsAlphanumeric + underscore only
Label/hintNo hard limitPractical: keep under 500 chars
Choices per listNo hard limit~100+ works well
Calculation expression~2000 charsComplex expressions may slow form
Form sizeNo hard limitVery large forms (500+ questions) may be slow
LanguagesUnlimitedUse label::language, hint::language syntax

Core Reference Files

Detailed documentation organized by topic:

Form Structure:

Questions & Types:

Logic & Calculations:

Advanced Features:

Best Practices & Troubleshooting:

Navigation:

Examples

See examples.md for 6 complete, working XLSForms:

  1. Basic Survey - Simple questions (text, integer, select_one)
  2. Conditional Logic - Skip logic with relevant
  3. Calculations & Validation - Constraints and calculated fields
  4. GPS & Media - Location tracking and photo capture
  5. Multilingual Form - Multiple languages
  6. 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:

  1. survey - Question definitions (type, name, label columns required)
  2. choices - Choice lists for select questions (list_name, name, label required)
  3. 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.py to 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

  1. Read this quick start and the minimal example above
  2. Check question-types.md for basic types
  3. Look at "Basic Survey" example in examples.md
  4. Use python scripts/validate_xlsform.py form.xlsx to check structure

Add conditional questions

  1. Read skip-logic.md
  2. Look at "Conditional Logic" example in examples.md
  3. Use relevant column with XPath expressions
  4. Examples: ${age} >= 18, selected(${previous_answer}, 'option')

Add calculations

  1. Read calculations.md
  2. Examples: sum, average, string concatenation, date arithmetic
  3. Use calculate question type for hidden computed values
  4. Use calculation column 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

  1. Run validation scripts to ensure no errors
  2. Upload .xlsx to platform or convert to .xml first
  3. Test on mobile device before deployment
  4. 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.py before conversion
  • Use constraints for user-facing validation, not just data cleaning
  • Add constraint_message to tell users why an answer is invalid
  • Test edge cases: empty inputs, extreme values, rapid skips

Multilingual Forms:

  • Use label::English and label::French syntax
  • 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.py first—it catches structural issues early
  • Check common-errors.md for error-specific solutions
  • Ensure question name fields are alphanumeric + underscore only

Form displays wrong on mobile?

  • Check question-types.md for type-specific appearances
  • Use appearance column 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_name in survey matches list_name in choices sheet (case-sensitive)
  • Run validate_xlsform.py to 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

  1. Start simple: Create a basic form using the minimal example above
  2. Validate: Run validate_xlsform.py to check structure
  3. Learn by example: Read examples.md for patterns you need
  4. Go deeper: Read specific reference/ docs for advanced features
  5. Deploy: Test thoroughly on mobile before using in production