# Approximate excel spreadsheet

I am trying to approximate the following table below.

After a lot of work I was able to produce the following table using the tabu package

In the MWE I included the showframe option, just to see where the figure spills into the margins. While close there are a few problems I have not been able to figure out

• Why is there a gap between the B and C column. Is it because of the multicolumn title?

• I used \tabu package along with the X column delimiters, despite this the table still runs into the right hand side margins. Why?

• I tested with a few different PDF'viewers and it seems there are a lot of inconsistensies in the horizontal and vertical rules. Is this possible to fix?

• While the result is close, the code is a complete dumpster fire. Could we obtain a similar table using a simpler code?

# MWE

\documentclass[tikz, border=1mm]{article}
\usepackage[utf8]{inputenc}

\usepackage[showframe]{geometry}

\usepackage{tabu}
\usepackage{multicol, multirow}
\usepackage[table]{xcolor}

\definecolor{maincolorLight}{HTML}{838fbc}
\definecolor{darkGray}{HTML}{e6e6e6}
\definecolor{lightGray}{HTML}{f2f2f2}

\usepackage{siunitx}

\newcolumntype{Y}{>{\columncolor{lightGray}}X}
\newcolumntype{g}{>{\columncolor{darkGray!80!black}}X[r]}

\newcommand{\tC}[1]{\multicolumn{1}{|c|}{\gK\textbf{#1}}}
\newcommand{\tR}[1]{\multicolumn{1}{|r|}{\gK\textbf{#1}}}
\newcommand{\tL}[1]{\multicolumn{1}{|l|}{\gK\textbf{#1}}}

\newcommand{\tD}[1]{\multicolumn{2}{|l}{\gK\textbf{#1}}}

\newcommand{\tM}[1]{\multicolumn{1}{|c|}{\gK$\num{#1}$}}
\newcommand{\tP}[1]{\multicolumn{1}{|c|}{\gK$\SI{#1}{\percent}$}}

\newcommand{\gK}{\cellcolor{darkGray}}
\newcommand{\cK}{\cellcolor{maincolorLight!50!}}

\newcommand{\tCc}[1]{\multicolumn{1}{|c|}{\cK #1}}
\newcommand{\tCw}[1]{\multicolumn{1}{|c|}{\cellcolor{white} #1}}

\newcommand{\Cline}[1]{\cline{1-1}\cline{#1}}

\newcommand{\tableTitle}{\multicolumn{5}{l}{\cellcolor{lightGray} \multirow{-2}{*}{\large \textbf{Skateberegning for personer med personinntekt over} $\num{565 400}$}}}

\begin{document}

\begin{table}[]
\centering
\begin{tabu} to \textwidth{g | Y *{5}{Y[5]}} \rowcolor{darkGray!80!black}
&A& B              & C              & D              & E                & F                   \\ \hline
& &                &                  &                &                &                     \\
1 & & \tableTitle                                                                               \\ \cline{1-1}
2 & &                &                  &                &                &                     \\ \Cline{3-5}
3 & & \tD{Personinntekt}                & \tCw{}         &                &                     \\ \Cline{3-5}
4 & & \tD{Samlet fradrag:}              & \tCw{}         &                &                     \\ \Cline{3-5}
5 & & \tD{Alminnelig Inntekt:}          & \tCc{}         &                &                     \\ \Cline{3-5}
6 & &                &                  &                &                &                     \\ \Cline{1-1}
7 & &                &                  &                &                &                     \\ \Cline{3-6}
8 & &  \tD{}                            &\tC{Prosentsats}& \tC{Beløp}     &                     \\ \Cline{3-6}
9 & &  \tD{Skatt av alminnelig inntekt:}& \tP{25}        & \tCc{}         &                     \\ \Cline{3-6}
10 & &  \tD{Trygdeavgift:}               & \tP{8.5}       & \tCc{}         &                     \\ \Cline{3-6}
11 & &                &                  &                &                &                     \\ \cline{1-1}
12 & & \textbf{Trinnskatt} &             &                &                &                     \\ \Cline{3-7}
13 & &  \tR{}         & \tC{Prosentsats} & \tC{Fra}       & \tC{Til}       & \tC{Skatt på trinn} \\ \Cline{3-7}
14 & &  \tL{Trinn 1:} & \tP{0.44}        & \tM{159800.00} & \tM{224900.00} & \tCc{286.44}        \\ \Cline{3-7}
15 & &  \tL{Trinn 2:} & \tP{1.7}         &\tM{224900.00}  & \tM{565400.00 }& \tCc{5788.50}       \\ \Cline{3-7}
16 & &  \tL{Trinn 3:} & \tP{10.7}        & \tM{565400.00} & \tM{909500.00} & \tCc{}              \\ \Cline{3-7}
17 & &  \tL{Trinn 4:} & \tP{13.7}        & \tM{909500.00} & \tL{}          & \tCc{}              \\ \Cline{3-7}
18 & &  \tL{Totalt:}  & \tL{}            & \tL{}          & \tL{}          & \tCc{}              \\ \Cline{3-7}
19 & &                &                  &                &                &                     \\ \Cline{3-4}
20 & & \tR{Samlet skatt:} & \tCc{}       &                &                &                     \\ \Cline{3-4}
21 & &                &                  &                &                &                     \\
\end{tabu}
\caption{Caption}
\label{tab:my_label}
\end{table}
\end{document}

• Maybe you should take a look at waht can be done with the spreadtab package. – Bernard Jun 1 at 19:17
• I tested with a few different PDF'viewers and it seems there are a lot of inconsistensies in the horizontal and vertical rules. Is this possible to fix? Sometimes I had also this problem, but when I changed the scaling of the viewer (or I printed it), then the problem disappeared. – knut Jun 1 at 19:27
• Side note: Why would you want to do this? If you you want to present the numbers to a reader, this is just really bad typography. If you want to show how the file looks when opened in your spreadsheet program, a screenshot would be more appropriate. – schtandard Jun 2 at 10:55
• @schtandard The question was how to do it, not why not do it. :) – Sveinung Jun 2 at 19:29
• @Sveinung: True, and my comment was not an answer. I do believe, however, that it is often worthwhile to stop and think "Why do I want to do this?". This is especially true in the context of trying to imitate some (suboptimal) behavior of other typesetting software in LaTeX. I have frequently found that the most helpful answer to a question of the type "How do I do this in LaTeX?" is "Don't, do this better thing instead." – schtandard Jun 3 at 8:51

NB! Do not use tabu. It is an outdated and depreciated package.

Using cals

Here is a possible solution using cals. In this second version, I have updated the code with lighter rules (0.4pt). The colours are set according to your MWE. I removed the background page colour and colourised the tabular light gray:

\documentclass[11pt, a4paper, twoside]{report} % If you use standard margins, you need
% footnotesize for table and enlarge the page with two
% baselineskips to have room for the table
\usepackage[utf8]{inputenc}
\usepackage[norsk]{babel}
\usepackage{xcolor, cals}

\renewcommand{\sfdefault}{uop}                % Optima as sans serif font
\renewcommand{\rmdefault}{\sfdefault}         % Whole document in sans serif

\usepackage{pdflscape}                        % It is necessary to set the table in landscape
% An alternative is to rotate the table

\let\nc=\nullcell                             % Shortcuts
\let\sc=\spancontent

\definecolor{maincolorLight}{HTML}{838fbc}
\definecolor{darkGray}{HTML}{e6e6e6}
\definecolor{lightGray}{HTML}{f2f2f2}

\begin{document}

%\pagecolor{gray!10}                        % Set page background light gray
\begin{landscape}
\footnotesize                               % If not, the tabular is to wide for the standard margins

\enlargethispage{3\baselineskip}            % If not, the tabular is to high for the standard margins

\noindent\begin{calstable}

% Defining 9 column relative to each other and relative to the margins
\colwidths{{\dimexpr(\columnwidth/90 *3)\relax}
{\dimexpr(\columnwidth/90 *3)\relax}
{\dimexpr(\columnwidth/90 *13)\relax}
{\dimexpr(\columnwidth/90 *13)\relax}
{\dimexpr(\columnwidth/90 *13)\relax}
{\dimexpr(\columnwidth/90 *13)\relax}
{\dimexpr(\columnwidth/90 *12)\relax}
{\dimexpr(\columnwidth/90 *10)\relax}
{\dimexpr(\columnwidth/90 *10)\relax}
}
% The 9 columns have to sum up to 90 to fill the text area

% Set up the tabular
\makeatletter
\def\cals@framers@width{0.4pt}   % Outside frame rules, decrease if you find the rule too heavy
\def\cals@framecs@width{0.4pt}
\def\cals@cs@width{0.4pt}        % Inside rules, decrease if you find the rule too heavy
\def\cals@rs@width{0.4pt}
\def\cals@bodyrs@width{0.4pt}    % The rule between title and body
\cals@setpadding{Ag}             % Default value
\cals@setcellprevdepth{Al}       % Default value
\def\cals@bgcolor{}              % Initiate cals@bgcolor to empty

\def\dgray{\ifx\cals@bgcolor\empty         % Colour switch (on-off)
\def\cals@bgcolor{darkGray!80!black}
\else \def\cals@bgcolor{} \fi}

\def\gray{\ifx\cals@bgcolor\empty          % Colour switch (on-off)
\def\cals@bgcolor{darkGray}
\else \def\cals@bgcolor{} \fi}

\def\lgray{\ifx\cals@bgcolor\empty         % Colour switch (on-off)
\def\cals@bgcolor{lightGray}
\else \def\cals@bgcolor{} \fi}

\def\white{\ifx\cals@bgcolor\empty         % Colour switch (on-off)
\def\cals@bgcolor{white}
\else \def\cals@bgcolor{} \fi}

\def\blue{\ifx\cals@bgcolor\empty          % Colour switch (on-off)
\def\cals@bgcolor{maincolorLight!50}
\else \def\cals@bgcolor{} \fi}

\def\bb{\ifx\cals@borderB\relax            % Bottom border switch (off-on)
\def\cals@borderB{0pt}
\else \let\cals@borderB\relax\fi}

\def\lb{\ifx\cals@borderL\relax            % Left border switch (off-on)
\def\cals@borderL{0pt}
\else \let\cals@borderL\relax\fi}

\def\rb{\ifx\cals@borderR\relax            % Right border switch (off-on)
\def\cals@borderR{0pt}
\else \let\cals@borderR\relax\fi}

\brow
\dgray\alignC\cell{}    % Switched on dark gray. Works until it is turned off.
\cell{A}
\cell{B}
\cell{C}
\cell{D}
\cell{E}
\cell{F}
\cell{G}
\cell{H}\dgray        % Switch off dark gray at the end of the row.
\erow
}
% R2 Body
\brow
\dgray\cell{\vfill1}\dgray
\lgray\bb\nc{ltb}
\nc{tb}
\nc{tb}
\nc{tb}
\nc{tb}
\nc{tb}
\nc{tb}
\nc{rtb}\sc{\rule{2pt}{0pt}\vfil\Large\bfseries Skatteberegning for personer med personinntekt over kr 565\,400}\bb\rb\lgray
\erow

% R3 Body
\brow
\rb\dgray\cell{2}\dgray\rb
\lgray\bb\cell{}
\bb\cell{}
\cell{}\bb
\cell{}
\cell{}
\cell{}
\cell{}
\rb\cell{}\lgray
\erow
% R4 Body
\brow
\bb\dgray\cell{3}\dgray\bb
\lgray\cell{}\lgray
\gray\bb\alignL\cell{\bfseries Personinntekt}\gray
\white\cell{}\white\rb\bb
\lgray\cell{}
\cell{}
\cell{}
\cell{}
\rb\cell{}\lgray
\erow
% R5 Body
\brow
\bb\dgray\alignC\cell{4}\dgray\bb
\lgray\cell{}\rb\lgray
\white\cell{}\white\rb\bb
\lgray\cell{}
\cell{}
\cell{}
\cell{}
\rb\cell{}\lgray
\erow
% R6 Body
\brow
\bb\dgray\alignC\cell{5}\dgray\bb
\lgray\cell{}\lgray
\gray\bb\alignL\cell{\bfseries Alminnelig inntekt:}\gray
\blue\cell{}\blue\bb\rb
\lgray\cell{}
\cell{}
\cell{}
\cell{}
\rb\cell{}\lgray
\erow
% R7 Body
\brow
\bb\dgray\alignC\cell{6}\dgray\rb\bb
\lgray\cell{}
\cell{}
\cell{}
\cell{}
\cell{}
\cell{}
\cell{}
\rb\cell{}\lgray
\erow
% R8 Body
\brow
\bb\dgray\cell{7}\dgray\bb
\lgray\rb\cell{}
\bb\cell{}
\cell{}
\cell{}
\cell{}\bb
\cell{}
\cell{}
\rb\cell{}\lgray
\erow
% R9 Body
\brow
\bb\dgray\cell{8}\dgray\bb
\lgray\cell{}\lgray
\gray\bb\nc{ltb}
\nc{rtb}\alignL\sc{}
\alignC\cell{\bfseries Prosentsats}
\cell{\bfseries Beløp}\rb\bb\gray
\lgray\cell{}
\cell{}
\rb\cell{}\lgray
\erow
% R10 Body
\brow
\bb\dgray\alignC\cell{9}\dgray\bb
\lgray\cell{}\lgray
\gray\bb\nc{ltb}
\nc{rtb}\alignL\sc{\bfseries Skatt av alminnelig inntekt:}
\alignC\cell{\bfseries 25 \%}\gray
\blue\cell{}\blue\bb\rb
\lgray\cell{}
\cell{}
\rb\cell{}\lgray
\erow
% R11 Body
\brow
\bb\dgray\cell{10}\dgray\bb
\lgray\cell{}\lgray
\gray\bb\nc{ltb}
\alignC\cell{\bfseries 8,2 \%}\gray
\blue\cell{}\blue\bb\rb
\lgray\cell{}
\cell{}
\rb\cell{}\lgray
\erow
% R12 Body
\brow
\bb\dgray\cell{11}\dgray\bb
\lgray\rb\cell{}
\cell{}
\cell{}
\cell{}
\cell{}
\cell{}
\cell{}
\rb\cell{}\lgray
\erow
% R13 Body
\brow
\bb\dgray\cell{12}\dgray\bb
\lgray\rb\cell{}
\bb\alignL\cell{\bfseries Trinnskatt}
\cell{}
\cell{}
\cell{}
\cell{}\bb
\cell{}
\rb\cell{}\lgray
\erow
% R5 Body
\brow
\bb\dgray\alignC\cell{13}\dgray\bb
\lgray\cell{}\lgray
\gray\bb\cell{}
\alignC\cell{\bfseries Prosentsats}
\cell{\bfseries Fra}
\cell{\bfseries Til}
\cell{\bfseries Skatt på trinn}\bb\rb\gray
\lgray\cell{}
\rb\cell{}\lgray
\erow
% R5 Body
\brow
\bb\dgray\alignC\cell{14}\dgray\bb
\lgray\cell{}\lgray
\gray\bb\alignL\cell{\bfseries Trinn 1:}
\alignC\cell{0,44 \%}
\alignL\cell{kr \hfill 159\,800,00}
\alignL\cell{kr \hfill 224\,900,00}\gray
\blue\cell{kr \hfill 286,44}\blue\bb\rb
\lgray\cell{}
\rb\cell{}\lgray
\erow
% R16 Body
\brow
\bb\dgray\alignC\cell{15}\dgray\bb
\lgray\cell{}\lgray
\gray\bb\alignL\cell{\bfseries Trinn 2:}
\alignC\cell{1,4 \%}
\alignL\cell{kr \hfill 224\,900,00}
\alignL\cell{kr \hfill 565\,400,00}\gray
\blue\cell{kr \hfill 5\,758,50}\blue\bb\rb
\lgray\cell{}
\rb\cell{}\lgray
\erow
% R17 Body
\brow
\bb\dgray\alignC\cell{16}\dgray\bb
\lgray\cell{}\lgray
\gray\bb\alignL\cell{\bfseries Trinn 3:}
\alignC\cell{10,7 \%}
\alignL\cell{kr \hfill 565\,400,00}
\alignL\cell{kr \hfill 909\,500,00}\gray
\blue\cell{}\blue\bb\rb
\lgray\cell{}
\rb\cell{}\lgray
\erow
% R18 Body
\brow
\bb\dgray\alignC\cell{17}\dgray\bb
\lgray\cell{}\lgray
\gray\bb\alignL\cell{\bfseries Trinn 4:}
\alignC\cell{13,7 \%}
\alignL\cell{kr \hfill 909\,500,00}
\alignL\cell{}\gray
\blue\cell{}\blue\bb\rb
\lgray\cell{}
\rb\cell{}\lgray
\erow
% R19 Body
\brow
\bb\dgray\alignC\cell{17}\dgray\bb
\lgray\cell{}\lgray
\gray\bb\alignL\cell{\bfseries Totalt:}
\alignC\cell{}
\alignL\cell{}
\alignL\cell{}\gray
\blue\cell{}\blue\bb\rb
\lgray\cell{}
\rb\cell{}\lgray
\erow
% R20 Body
\brow
\bb\dgray\cell{19}\dgray\bb
\lgray\rb\cell{}
\bb\cell{}
\cell{}\bb
\cell{}
\cell{}
\cell{}
\cell{}
\rb\cell{}\lgray
\erow
% R21 Body
\brow
\bb\dgray\cell{20}\dgray\bb
\lgray\cell{}\lgray
\gray\bb\alignL\cell{\bfseries Samlet skatt:}\gray
\blue\cell{}\bb\blue\rb
\lgray\cell{}
\cell{}
\cell{}
\cell{}
\rb\cell{}\lgray
\erow
% R22 Body
\brow
\bb\dgray\cell{21}\dgray
\lgray\rb\cell{}
\cell{}
\cell{}
\cell{}
\cell{}
\cell{}
\cell{}
\rb\cell{}\lgray
\erow
\makeatletter
\end{calstable}\par % \par needed to align the tabular
\end{landscape}
\end{document}


Using tabular and friends

After several trials, I managed to build your tabular using standard tabular, colortbl and hhline. Building the tabular is easy, but when you start colourising, the problems begin. When using colours in tables, clines and other rules are overwritten by the colour. This is documented in the colortbl-manual. You have to build the rules line by line, using hhline’s syntax. When you remove part of a rule (to mimic cline), hhline leaves thin white stripes instead (f.ex. the ligth gray background). This answer gives a solution by changing arraycolor to the background colour. The syntax is bulky, in particular in complex tabular where you have to switch on and off arraycolour multiple times.

I defined some shorthands to reduce clutter, but if you find cals’ syntax verbose, it is nothing compared to this. In my opinion, cals is better suited for this types of tabulars; well worth learning.

Below is the new MWE and the resulting tabular:

\documentclass[a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[margin=1cm]{geometry}
\usepackage{multicol, array, hhline}
\usepackage[table]{xcolor}

\definecolor{maincolorLight}{HTML}{838fbc}
\definecolor{darkGray}{HTML}{e6e6e6}
\definecolor{lightGray}{HTML}{f2f2f2}

\renewcommand{\arraystretch}{1.3}
\setlength{\extrarowheight}{1pt}

\newcommand{\tableTitle}{\multicolumn{5}{l|}{\cellcolor{lightGray}\large\bfseries Skatteberegning for personer med personinntekt over kr~565\,400\rule{0pt}{4ex}}}
\newcommand{\blvi}[1]{\multicolumn{6}{l|}{\cellcolor{lightGray}#1}}
\newcommand{\blv}[1]{\multicolumn{5}{l|}{\cellcolor{lightGray}#1}}
\newcommand{\bliii}{\multicolumn{3}{l|}{\cellcolor{lightGray}}}
\newcommand{\blii}{\multicolumn{2}{l|}{\cellcolor{lightGray}}}
\newcommand{\mig}[1]{\multicolumn{1}{l}{\cellcolor{lightGray}\textbf{#1}}}
\newcommand{\mcdg}[1]{\multicolumn{1}{c|}{\cellcolor{darkGray}#1}}
\newcommand{\midg}[1]{\multicolumn{1}{|c|}{\cellcolor{darkGray}#1}}
\newcommand{\dgr}{\cellcolor{darkGray}}
\newcommand{\lgr}{\cellcolor{lightGray}}

\begin{document}

\begin{table}[tbh]
\centering\small
\begin{tabular}{|l|l|l|l|r|r|r|}

\hhline{*{7}{-}}
\dgr{}
&\mcdg{A}
& \mcdg{B}
&\mcdg{C}
&\mcdg{D}
&\mcdg{E}
&\mcdg{F}
\\
\hhline{*{7}{-}}
\midg{1}
&\mig{}
&\tableTitle
\\
\hhline{|-|*{6}{>{\arrayrulecolor{lightGray}}-}|}\arrayrulecolor{black}
\midg{2}
&\blvi{}
\\
\hhline{|-|>{\arrayrulecolor{lightGray}}->{\arrayrulecolor{black}}--|>{\arrayrulecolor{lightGray}}---|}
\arrayrulecolor{black}
\midg{3}
&\lgr
&\dgr\textbf{Personinntekt:}
&% white cell
&\bliii
\\
\hhline{|-|>{\arrayrulecolor{lightGray}}->{\arrayrulecolor{black}}--|>{\arrayrulecolor{lightGray}}---|}
\arrayrulecolor{black}
\midg{4}
&\lgr
&% white cell
&\bliii
\\
\hhline{|-|>{\arrayrulecolor{lightGray}}->{\arrayrulecolor{black}}--|>{\arrayrulecolor{lightGray}}---|}
\arrayrulecolor{black}
\midg{5}
&\lgr
&\dgr\textbf{Alminnelig inntekt:}
&\cellcolor{maincolorLight}
&\bliii
\\
\hhline{|-|>{\arrayrulecolor{lightGray}}->{\arrayrulecolor{black}}--|>{\arrayrulecolor{lightGray}}---|}
\arrayrulecolor{black}
\midg{6}
&\blvi{}
\\
\hhline{|-|*{6}{>{\arrayrulecolor{lightGray}}-}|}
\arrayrulecolor{black}
\midg{7}
&\blvi{}
\\
\hhline{|-|>{\arrayrulecolor{lightGray}}->{\arrayrulecolor{black}}---|>{\arrayrulecolor{lightGray}}--|}
\arrayrulecolor{black}
\midg{8}
&\lgr
&\dgr
&\dgr\textbf{Prosentsats}
&\dgr\textbf{Beløp}
&\blii
\\
\hhline{|-|>{\arrayrulecolor{lightGray}}->{\arrayrulecolor{black}}---|>{\arrayrulecolor{lightGray}}--|}
\arrayrulecolor{black}
\midg{9}
&\lgr
&\dgr\textbf{Skatt av alminnelig inntekt:}
&\mcdg{25\,\%}
&\cellcolor{maincolorLight}
&\blii
\\
\hhline{|-|>{\arrayrulecolor{lightGray}}->{\arrayrulecolor{black}}---|>{\arrayrulecolor{lightGray}}--|}
\arrayrulecolor{black}
\midg{10}
&\lgr
&\mcdg{8,5\,\%}
&\cellcolor{maincolorLight}
&\blii
\\
\hhline{|-|>{\arrayrulecolor{lightGray}}->{\arrayrulecolor{black}}---|>{\arrayrulecolor{lightGray}}--|}
\arrayrulecolor{black}
\midg{11}
&\blvi{}
\\
\hhline{|-|*{6}{>{\arrayrulecolor{lightGray}}-}|}
\arrayrulecolor{black}
\midg{12}
&\mig{}
&\blv{\textbf{Trinnskatt}}
\\
\hhline{|-|>{\arrayrulecolor{lightGray}}->{\arrayrulecolor{black}}-----|}
\midg{13}
&\lgr
&\dgr
&\dgr{\textbf{Prosentsats}}
&\mcdg{\textbf{Fra}}
&\mcdg{\textbf{Til}}
&\dgr{\textbf{Skatt på trinn}}
\\
\hhline{|-|>{\arrayrulecolor{lightGray}}->{\arrayrulecolor{black}}-----|}
\midg{14}
&\lgr
&\dgr\textbf{Trinn 1:}
&\mcdg{0,44\,\%}
&\dgr{159\,800,00}
&\dgr{224\,900,00}
&\cellcolor{maincolorLight}\textbf{286,44}
\\
\hhline{|-|>{\arrayrulecolor{lightGray}}->{\arrayrulecolor{black}}-----|}
\midg{15}
&\lgr
&\dgr\textbf{Trinn 2:}
&\mcdg{1,7\,\%}
&\dgr{224\,900,00}
&\dgr{565\,400,00}
&\cellcolor{maincolorLight}\textbf{5788,50}
\\
\hhline{|-|>{\arrayrulecolor{lightGray}}->{\arrayrulecolor{black}}-----|}
\midg{16}
&\lgr
&\dgr\textbf{Trinn 3:}
&\mcdg{10,7\,\%}
&\dgr{565\,400,00}
&\dgr{909\,500,00}
&\cellcolor{maincolorLight}
\\
\hhline{|-|>{\arrayrulecolor{lightGray}}->{\arrayrulecolor{black}}-----|}
\midg{17}
&\lgr
&\dgr\textbf{Trinn 4:}
&\mcdg{13,7\,\%}
&\dgr{909\,500,00}
&\dgr
&\cellcolor{maincolorLight}
\\
\hhline{|-|>{\arrayrulecolor{lightGray}}->{\arrayrulecolor{black}}-----|}
\midg{18}
&\lgr
&\dgr\textbf{Totalt:}
&\dgr
&\dgr
&\dgr
&\cellcolor{maincolorLight}
\\
\hhline{|-|>{\arrayrulecolor{lightGray}}->{\arrayrulecolor{black}}-----|}
\midg{19}
&\blvi{}
\\
\hhline{|-|>{\arrayrulecolor{lightGray}}->{\arrayrulecolor{black}}--|>{\arrayrulecolor{lightGray}}---|}
\arrayrulecolor{black}
\midg{20}
&\lgr
&\dgr\textbf{Samlet skatt:}
&\cellcolor{maincolorLight}
&\bliii
\\
\hhline{|-|>{\arrayrulecolor{lightGray}}->{\arrayrulecolor{black}}--|>{\arrayrulecolor{lightGray}}---|}
\arrayrulecolor{black}
\midg{21}
&\blvi{}
\\
\lasthline
\end{tabular}
\caption{Caption}
\label{tab:my_label}
\end{table}
\end{document}


• My sincere compliments. I not know the cals package. – Sebastiano Jun 2 at 8:54
• Excellent answer, I have now accepted it. Sorry for the delay I have been busy at work. Are there any modern alternatives to using tabu? =) – N3buchadnezzar Jun 8 at 19:32
• @N3buchadnezzar I have read some places that somebody are working on an updated tabu. I used tabu a lot some years ago, and I my impressions is that (not even an updated) tabu probably will not help you construct the type of spreadsheet you are asking for. LaTeX tabular is focused on traditional tabular material, i.e. columns with similar type of data. Since you are a programmer, you may make a nice interface in you favourite programming language, which take your input and produce the code to produce a cals-tabular. – Sveinung Jun 8 at 20:32

Worth to mention that the package pas-tableur was made specifically to create a spreadsheet layouts, although probably not those with rich cell formattings (different grid thickness/backgrounds, etc.) as showed in the question (or maybe is perfect for this purpose, really I never used it).

\documentclass{article}
\usepackage{pas-tableur}
\begin{document}

\begin{tikzpicture}
\tableur[8]{A,B,C,D,E}
\celtxt[color=red]{D}{1}{=B3}
\celtxt*[r]{A}{3}{$\pi =$}
\celtxt*{B}{3}{3.14}
\selecCell{C}{5}
\celtxt[l]{C}{5}{28/12/2017}
\multiSelec{A-1}{C-2}
\celtxt[c]{B}{7}{Very long text that take more than one cell}
\end{tikzpicture}

\end{document}