Skip to content

Explains how to import error content from a local XLSX (Excel) file. Simple to use without any external API or authentication.

Quick Start with Template

Download the pre-made XLSX template to get started right away. Includes both Korean and English sheets.

Download XLSX Template

TIP

After downloading, edit the data and run huh pull.


Writing an XLSX File

In Excel, create the first row as a header row:

trackIdtypemessagetitleimageseverityactionLabelactionTypeactionTarget
ERR_LOGIN_FAILEDTOASTLogin failed
ERR_SESSION_EXPIREDMODALSession has expiredSession ExpiredERRORLogin AgainREDIRECT/login
ERR_NOT_FOUNDPAGEPage not found404/img/404.pngINFOGo HomeREDIRECT/

TIP

Even if entered in lowercase, the CLI will automatically convert to uppercase. Custom types (BANNER, SNACKBAR, etc.) can also be used freely.

Column Rules

Column NameRequiredDescription
trackIdYesUnique error ID (e.g., ERR_LOGIN_FAILED)
typeYesTOAST, MODAL, PAGE, or custom type
messageYesError message. Supports template variables
titleError title (for modal, page)
imageImage URL (for page)
severityINFO, WARNING, ERROR, CRITICAL, or custom severity
actionLabelAction button text
actionTypeREDIRECT, RETRY, BACK, DISMISS, or custom action
actionTargetURL to navigate to for REDIRECT

Configuration

.huh.config.json

json
{
  "source": {
    "type": "xlsx",
    "filePath": "./errors.xlsx"
  },
  "output": "./src/huh.json"
}

To specify a particular sheet, use the sheet option:

json
{
  "source": {
    "type": "xlsx",
    "filePath": "./errors.xlsx",
    "sheet": "ErrorList"
  },
  "output": "./src/huh.json"
}

If sheet is not specified, the first sheet is used.

.huh.config.ts

ts
import { defineConfig } from '@sanghyuk-2i/huh-cli';

export default defineConfig({
  source: {
    type: 'xlsx',
    filePath: './errors.xlsx',
    // sheet: 'ErrorList',  // Optional: uses first sheet if not specified
  },
  output: './src/huh.json',
});

filePath can be a relative or absolute path. Relative paths are resolved from process.cwd().

Fetching Data

bash

If successful, a JSON file will be generated at the output path.

Notes

  • Only .xlsx format is supported (legacy .xls format is not supported).
  • The sheet must contain a header row + at least 1 data row.
  • If the specified sheet name does not exist, an error will be shown along with the list of available sheets.
  • Uses the SheetJS library.

Released under the MIT License.