Based on my answer at How to put content from multiple databases in one table using datatool?, I came up with this. Currently, this MWE reads the data from a file data.txt, currently containing
dfkdsfs
sdf
dsfdsfgsdfg
ds4543
rg
ere
r
ewrf
sfs
edfds
swdf
sdfdsfdsfdsf
rtg
435
rtgre
t546
tgr
ret
4trswe
dfdf
fdfsdf
435435rsggf
dsfds
gff
vcvx
gfgfd
asdfdsf
rt
34
32e3
~
though the external file can be dispensed with if the \readdef{data.txt}{\tmpa} were replaced by
\def\tmpa{dfkdsfs sdf dsfdsfgsdfg ds4543 rg ere r ewrf sfs edfds swdf
sdfdsfdsfdsf rtg 435 rtgre t546 tgr ret 4trswe dfdf fdfsdf 435435rsggf
dsfds gff vcvx gfgfd asdfdsf rt 34 32e3 ~
}
The ~ in the last row is a filler (I'll come back to that). I'm also assuming that data entries have no spaces, which I inferred from the OP's description. The macro \readArrayij{\tmpa}{first}{3} reads the data into an array identified as first, with 3 columns. Partial rows are discarded, and so here is why I added a blank and newline at the end of the data, so that a partial row is not lost.
The structure uses Herbert's \tabtoks approach (How to programmatically make tabular rows using `\whiledo` ?) to add the data to a tabular, 3 elements at a time, in this case, adding an index identifier to the front end.
\documentclass{article}
\usepackage{readarray}
\newcounter{index}
\newcounter{mycell}
% Based on:
% https://tex.stackexchange.com/questions/7590/
% how-to-programmatically-make-tabular-rows-using-whiledo
\makeatletter
\newcounter{tabindex}
\newtoks\@tabtoks
\newcommand\addtabtoks[1]{%
\@tabtoks\expandafter{\the\@tabtoks\stepcounter{tabindex}#1}}
\newcommand*\resettabtoks{\@tabtoks{}}
\newcommand*\synctabindex[1]{\setcounter{tabindex}{\value{#1}}}
\newcommand*\printtabtoks{\the\@tabtoks}
\makeatother
\begin{document}
\readdef{data.txt}{\tmpa}
\readArrayij{\tmpa}{first}{3}
%
\resettabtoks
\setcounter{index}{0}
\setcounter{mycell}{0}
\synctabindex{index}
\whiledo{\value{index} < \numexpr\firstROWS\relax}{%
\addtabtoks{%
\stepcounter{mycell}
\themycell: \arrayij{first}{\thetabindex}{1} &
\stepcounter{mycell}
\themycell: \arrayij{first}{\thetabindex}{2} &
\stepcounter{mycell}
\themycell: \arrayij{first}{\thetabindex}{3}
\ifthenelse{\equal{\thetabindex}{\nrows}}{\\\hline}{\\\hline}%
}
\addtocounter{index}{1}%
}
\begin{tabular}{|l|l|l|}
\hline
\printtabtoks
\end{tabular}
\end{document}
