Here is an simple example.
\documentclass{article}
\usepackage[table]{xcolor}
\usepackage{colortbl}
\usepackage{multirow, makecell}
\begin{document}
\begin{tabular}{c}
longer text\\
\cellcolor{teal}\\
\cellcolor{teal}\multirowcell{-2}[0ex][r]{short\\short}
% \cellcolor{teal}\multirow{-2}*{short} % is ok but can't break line or set alignment
\end{tabular}
\end{document}
When the text in the multirowcell is shorter than than the text of the above cell, the cell will not be colored well. multirow is ok, but I want to break line inside the cell and set the alignment.
Cauze the code will be generated by python and the width of the column is impossible to be accessed in program nor be setted to a just suitable value, options such as p, w in array or X in tabularx is not considered.





\begin{tabular}{@{}l@{}}in the entry, but getting multiple lines within a cell is completely unrelated to making that cell span rows or columns. – David Carlisle Apr 24 '20 at 09:41