Skip to content

About

A command-line tool for converting booking data from Edelweiss format to TravelLine-compatible Excel files

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Edelweiss to TravelLine Bookings Converter

A command-line tool for converting booking data from Edelweiss format to TravelLine-compatible Excel files.

Overview

This converter processes Edelweiss (PMS) booking spreadsheets and transforms them into the TravelLine (channel manager) import format. It automatically detects worksheets, parses booking entries, filters organizational bookings, and generates properly formatted Excel output ready for TravelLine import.

Features

  • Automatic worksheet detection: Finds the correct worksheet and header row in Edelweiss Excel files
  • Smart filtering: Excludes bookings with organization assignments (keeps only individual bookings)
  • Flexible I/O: Supports file input/output or stdin/stdout for pipeline integration
  • Customizable mapping: Configurable room category mapping and check-in/check-out times based on tariff type
  • Type-safe: Built with TypeScript in strict mode for reliability

Requirements

  • Bun runtime (v1.3.1 or later)
  • Node.js-compatible environment

Installation

bun install

Usage

Recommended Usage (stdin/stdout)

The most flexible way to use the converter is via stdin/stdout piping:

cat input.xlsx | bun start -- convert > output.xlsx

This approach allows you to:

  • Use any file path for input and output
  • Integrate with shell scripts and pipelines
  • Avoid temporary files

Alternative Usage Options

Input from file, output to file:

bun start -- --input ./fixtures/sample.xlsx --output ./out/bookings.xlsx

Input from stdin, output to file:

cat input.xlsx | bun start -- --output output.xlsx

Input from file, output to stdout:

bun start -- --input ./fixtures/sample.xlsx | hexdump -C | head

Command-Line Options

  • -i, --input [path] - Path to the input Edelweiss Excel file (optional if reading from stdin)
  • -o, --output [path] - Path to the output TravelLine Excel file (optional, defaults to stdout)
  • --version - Display version information
  • --help - Display help information

Conversion Logic

Booking Filtering

The converter automatically filters out bookings where:

  • Organization field is present and not empty
  • Organization value is - or НЕТ

Only individual bookings (without organization assignments) are included in the output.

Room Category Mapping

Room categories are mapped based on room numbers:

  • Room 102 → Стандарт
  • Other rooms → Room number as-is
  • Missing room number → Не указано

Check-in/Check-out Times

  • Check-in: 15:00 for apartments (tariff contains "апартамент"), 14:00 otherwise
  • Check-out: 12:00 for all bookings

Currency

Default currency is RUB (Russian Ruble). Currency from source data is preserved when available.

Development

Project Structure

src/
├── index.ts              # CLI entry point
└── lib/
    ├── edelweiss/        # Edelweiss format parsing
    │   ├── reader.ts     # Excel reading and worksheet detection
    │   ├── parser.ts     # Row parsing logic
    │   ├── types.ts      # Type definitions
    │   └── utils.ts      # Date parsing utilities
    └── travelline/       # TravelLine format generation
        ├── converter.ts  # Booking conversion logic
        ├── writer.ts     # Excel writing
        ├── types.ts      # Type definitions
        └── utils.ts      # Name parsing and formatting

Scripts

  • bun start - Run the converter CLI
  • bun run lint - Run Biome linter in check mode
  • bun run lint:fix - Run Biome linter with auto-fix

Code Style

  • TypeScript strict mode
  • Biome for formatting and linting
  • Tabs for indentation, 100-character line limit
  • Named exports preferred (no default exports)
  • Conventional Commits for git history

Input Format

The converter expects Edelweiss Excel files with the following headers (in order):

  • № (Row number)
  • Бронь (Booking ID)
  • Создано (Creation date)
  • Номер (Room number)
  • Плательщик (Payer name)
  • Организация (Organization)

Additional columns expected:

  • Пол (Gender)
  • ВЗР (Adults count)
  • Заезд (Check-in date)
  • Выезд (Check-out date)
  • Сут. (Nights)
  • Tariff (column P, no header)
  • Amount paid (column Q, no header)

Output Format

The converter generates TravelLine-compatible Excel files with the following required columns:

  • Номер бронирования (*) - Booking number
  • Дата и время заезда (*) - Check-in datetime
  • Дата и время выезда (*) - Check-out datetime
  • Категория номера (*) - Room category
  • Тарифный план (*) - Rate plan/tariff
  • Количество взрослых (*) - Number of adults
  • Стоимость (*) - Total cost
  • Валюта (*) - Currency code
  • Фамилия гостя (*) - Guest last name

Optional columns include: Количество детей, Оплачено, Имя гостя, Отчество гостя, Гражданство гостя, Телефон гостя, EMail гостя.

Error Handling

The converter exits with appropriate error codes:

  • 1 - File not found, invalid input format, or conversion errors
  • 0 - Successful conversion

Error messages are written to stderr to avoid interfering with binary output when piping.

License

This project is licensed under the MIT License with a Commercial Attribution Clause.

Summary:

  • ✅ Free to use, modify, and distribute for any purpose
  • ✅ No liability - use at your own risk
  • 📝 Commercial use: If you use this code in a commercial project or earn money with it, please:
    • Provide attribution to the original author
    • "Buy the author a beer" - make a reasonable contribution to support the project

See LICENSE.md for full license text.

About

A command-line tool for converting booking data from Edelweiss format to TravelLine-compatible Excel files

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages