Overview
I created an example workflow for generating TEI/XML from data created in Excel.
The following TEI/XML file is output. It supports page breaks using the pb tag, line ID specification using the lb tag, multiple representations using the choice/orig/reg tags, annotations using the note tag, and association with IIIF images.
An example visualization of the above TEI/XML data is shown below. The image, text (original), text (regularization), and annotations are displayed on the same screen.

Note that while I used the text of the Koui Genji Monogatari (Variorum Tale of Genji) in this example, the app element would be more appropriate for describing textual variants. Please understand this as sample data intended to explain the workflow.
Excel
The sample Excel data to create is as follows. It has three sheets: image, text, and notes. Each is explained below.
https://github.com/nakamura196/tei_excel_tools/blob/main/demo/data/sample.xlsx?raw=true
“image” Sheet
This describes information about the IIIF manifest file. Please assign a unique ID for page_id.
“text” Sheet
In addition to the page_id specified earlier, a new line_id is added. Enter the text for choice > orig in text1 and the text for choice > reg in text2.
| page_id | line_id | text1 | text2 |
|---|---|---|---|
| page_22 | page_22-b-1 | いつれの御時にか女御更衣あまたさふらひ給けるなかにいとやむことなきゝは | いつれの御時にか女御更衣あまたさふらひたまふなかにいとやむことなきゝは |
In the example above, there is a difference between “給ける” and “たまふ”.
“notes” Sheet
This describes annotation information.
In addition to the previously created page_id and line_id, a new note_id is added. The pos field specifies at which character position in the line the annotation should be placed. type and subtype are optional. text provides the content of the annotation. image is optional and provides the IIIF image URL for the annotation. How to obtain this URL is described later.
| note_id | page_id | line_id | pos | type | subtype | text | image |
|---|---|---|---|---|---|---|---|
| page_22-b-1-20 | page_22 | page_22-b-1 | 22 | 校異 | 給けるーたまふ河 | https://dl.ndl.go.jp/api/iiif/3437686/R0000022/1044,895,82,424/full/0/default.jpg |
Converting to TEI/XML
The notebook for uploading Excel and downloading the TEI/XML file is available here.
https://colab.research.google.com/github/nakamura196/ndl_ocr/blob/main/tei_excel_tools.ipynb
Obtaining the IIIF Image URL for Annotations
This explains how to obtain the IIIF image URL for annotations mentioned earlier. We use the IIIF Curation Viewer created by the Center for Open Data in the Humanities.
Open the image containing the annotation by specifying the manifest and pos in the URL format below.
Next, click the button shown in the red box in the figure below to select the annotation area.

Then, click on the annotation area and the URL will be displayed.

Paste this URL into the Excel file.
Summary
This is a use-case-specific method for creating TEI/XML files, but I hope it serves as a helpful reference.