The following example has rotated headers. The height of this header row is determined by the longest string, in this case the units in the last column. Now, this code is generated in C#. In C# I could find out which string is the longest, before generation. But:
The units string is determined by Latex, later in the compiling process. So Latex must find the critical string length and adjust the row height, by this string "Long Lo". The given solution won't do it: it's "static" in Latex, while the row height is "dynamic", even more so because this example might be generated in a different language.
Question: any ideas as to how to tackle this problem and have the Latex compiler figure it out?
\documentclass[11pt,a4paper]{article}
\usepackage[
per-mode=symbol,
round-mode=places,
round-precision=2,
table-format = 1.2,
table-number-alignment=right,
round-integer-to-decimal,
output-decimal-marker={.}
]{siunitx}
\usepackage{makecell}
\usepackage[utf8]{inputenc}
\usepackage[left=1.3cm,right=1.3cm,top=1.8cm,bottom=4.0cm,marginparwidth=3.4cm]{geometry}
\usepackage{lscape} \
\usepackage{rotating}
\usepackage{array}
\usepackage{booktabs}
\usepackage{caption}
\usepackage{longtable}
\begin{document}
\settowidth\rotheadsize{Long Lo} % ==============HERE IT IS !!===============
\begin{longtable}{ccrrrrr}
\caption{Materials}\label{tab:Materials}\\
\toprule[2pt]
\multicolumn{7}{c}{Materials}\\
\cmidrule(lr){1-7}
\multicolumn{1}{c}{\rothead{Code}}&\multicolumn{1}{c}{\rothead{Name}}&\multicolumn{1}{l}{\rothead{E\\ $[\si{\mega\pascal}]$}} &\multicolumn{1}{r}{\rothead{G}}
&\multicolumn{1}{r}{\rothead{$\gamma_m$}}&\multicolumn{1}{r}{\rothead{$\rho$\\ $[\si{\kilogram\per\cubic\meter}]$}}&\multicolumn{1}{r}{\rothead{$f_y$\\ $[\si{\newton\per\milli\meter\squared}]$}}\\
\cmidrule(lr){1-1}\cmidrule(lr){2-2}\cmidrule(lr){3-3}\cmidrule(lr){4-4}\cmidrule(lr){5-5}\cmidrule(lr){6-6}\cmidrule(lr){7-7}
\endfirsthead
\caption{Materials (Continued)}\\
\multicolumn{7}{c}{Materials}\\
\cmidrule(lr){1-7}
\multicolumn{1}{c}{\rothead{Code}}&\multicolumn{1}{c}{\rothead{Name}}&\multicolumn{1}{l}{\rothead{E\\ $[\si{\mega\pascal}]$}} &\multicolumn{1}{r}{\rothead{G }}&\multicolumn{1}{r}{\rothead{$\gamma_m$ \\ $[]$}}&\multicolumn{1}{r}{\rothead{$\rho$\\ $[\si{\kilogram\per\cubic\meter}]$}}&\multicolumn{1}{r}{\rothead{$f_y$\\ $[\si{\newton\per\milli\meter\squared}]$}}\\
\cmidrule(lr){1-1}\cmidrule(lr){2-2}\cmidrule(lr){3-3}\cmidrule(lr){4-4}\cmidrule(lr){5-5}\cmidrule(lr){6-6}\cmidrule(lr){7-7}
\endhead
\multicolumn{7}{c}{ Continued on next page}
\endfoot
\endlastfoot
S235 &S235 &210 &81 &1.15 &7800 &235 \\
\bottomrule[1pt]
\end{longtable}
\end{document}