結合したセルの扱い
- 確かめる
- 直す
Excelの表には、見栄えのために、セルを結合していることがあります。Excelの表をHTML・Markdownにする で変換すると、結合したセルは、左上の1つだけに文字が入り、ほかのセルは空になります。
変換のルール
- 結合したセルは、左上の1つだけに文字が入る。
- そのほかのセルは、空になる。
起こりやすいこと
- 「分類」のセルを3行分結合 → 1行目だけに「分類」が入り、2・3行目は空になる
- 表のタイトルを、全列で結合 → 最初の列だけにタイトルが入る
手順(きれいに変換するには)
- 変換する前に、Excelで結合を解除する。
- 空になったセルに、同じ文字を入れる。
- このツールで、変換する。
- 変換後の表を確かめる。
結合を解除するコツ
- 結合したセルを選ぶ。
- 「セルを結合して中央揃え」を押して、解除する。
- 空になったセルに、文字をコピーして入れる。
結合しないほうがよい理由
- 並べ替えや、フィルターがうまく動かない
- データとして扱うときに、空のセルが邪魔になる
- Webページや、システムに貼るときに、崩れやすい
変換後に直す方法
HTMLで、結合したままにしたい場合は、変換後のHTMLに、colspan(列の結合)や rowspan(行の結合)を手で書き足します。
向いている場面
- 結合セルのない、きれいな表の変換
- 結合セルを含む表の、データだけを取り出す
例
月ごとの集計表で、「第1四半期」が3か月分結合されていた。変換すると、1月だけに文字が入ったので、Excelで結合を解除して、各月に入れ直してから、やり直した。
つまずきやすい点
- 文字が消えたように見える:結合のとき、左上以外は空になる。
- 列がずれる:結合を解除してから、変換する。
よくある質問
結合のまま、変換できますか?
結合の見た目は、含まれません。解除するのが確実です。
まとめ
結合セルは、左上だけに文字が入る。変換前に解除しておくと、きれいにできます。
Excelの表をHTML・Markdownにするを使う(無料)あわせて使えるツール
- ExcelをCSV・JSONに変換する:Excelのシートを、CSV・TSV・JSONに変換します。
- WordをHTMLに変換する:Wordの文章を、Webに貼れるHTMLにします。
- CSVとJSONを相互変換する:CSVとJSONを、すぐに相互変換します。
同じツールの、ほかの解説
How Merged Cells Are Handled
- Check
- Fix
Excel tables sometimes have merged cells for looks. When converted with Convert an Excel Table to HTML or Markdown, a merged cell's text goes only into the top-left one, and the other cells become empty.
Conversion rule
- A merged cell's text goes only into the top-left cell.
- The other cells become empty.
What commonly happens
- A "Category" cell merged across 3 rows → only the first row holds "Category"; rows 2 and 3 are empty
- A table title merged across all columns → only the first column holds the title
Steps (to convert cleanly)
- Before converting, unmerge cells in Excel.
- Fill the now-empty cells with the same text.
- Convert with this tool.
- Check the converted table.
Tips for unmerging
- Select the merged cell.
- Press "Merge & Center" to unmerge.
- Copy the text into the emptied cells.
Why not to merge
- Sorting and filtering don't work well
- Empty cells get in the way when handling it as data
- It breaks easily when pasted into web pages or systems
How to fix after converting
If you want to keep merging in HTML, add colspan (column merge) or rowspan (row merge) by hand to the converted HTML.
Good for
- Converting clean tables without merged cells
- Extracting just the data from tables that contain merged cells
Example
In a monthly summary, "Q1" was merged across three months. After converting, only January had the text, so I unmerged in Excel, re-entered it for each month and redid it.
Common stumbling blocks
- The text seems to have vanished: when merged, everything except the top-left is empty.
- Columns shift: unmerge before converting.
Frequently asked questions
Can it convert keeping the merge?
The merged look isn't included. Unmerging is the reliable way.
Summary
For merged cells, only the top-left gets the text. Unmerge before converting for a clean result.
Use "Convert an Excel Table to HTML or Markdown" (free)Tools that go well with this
- Convert Excel to CSV or JSON: Convert an Excel sheet to CSV, TSV or JSON.
- Convert Word to HTML: Turn Word text into HTML.
- Convert CSV and JSON: Convert between CSV and JSON instantly.