# Input values in table from external file and increment rows accordingly [duplicate]

This question already has an answer here:

I am trying to create a report in table format and values in table have to input from some external file (or excel file). Can this be achieved in Latex? If yes, then the number of table rows should be auto increment according to input data. I tried using \longtablebut could not succeed. following is my code.

\documentclass{article}
\usepackage[a4paper,margin=0.7 in,landscape]{geometry}
\usepackage{array}
\usepackage[thinlines]{easytable}
\usepackage{geometry}
\usepackage{fancyhdr, graphicx}
\usepackage{tabulary}
\usepackage{fancyhdr}
\usepackage{lastpage}
\usepackage{multirow}
\usepackage{longtable}
\usepackage{float}
\usepackage{ltablex}
\pagestyle{fancy}
%  \hline
\multirow{2}{*}{\includegraphics[width=30pt]{logo.jpg}} &          \multicolumn{1}{l}{\textbf{Variable Messsage Sign Report}}  \\
& \multicolumn{1}{l}{Downloaded by USER on DATE and TIME}
\end{tabular}\\}
\cfoot{\thepage\ / \pageref{LastPage}}
\renewcommand{\footrulewidth}{0.4pt}
\makeatletter
\setlength{\@fptop}{0pt}
\begin{document}
\begin{figure}
\centering
\includegraphics[width=0.3\linewidth]{hcc.jpg}
\vspace{-100 px}
\end{figure}
\vspace{-400 px}
\begin{table}[]
\textbf{Variable Message Sign Summary} \\
\centering
\noindent\begin{minipage}[t][4in][t]{\textwidth}
\centering
\bgroup
\def\arraystretch{2}
\begin{longtable}[100pt]    {|p{2.5cm}|p{2.5cm}|p{2.5cm}|p{2.5cm}|p{2.5cm}|p{2.5cm}|p{2.5cm}|p{2.5cm}|p{2.5cm}|}
\hline
\textbf{Status} & \textbf{SCN} & \textbf{Slide} & \textbf{Message\_Text} &     \textbf{Time} & \textbf{Created\_by} & \textbf{Created\_on} &     \textbf{Updated\_on} & \textbf{Deleted\_on} \\ \hline
&sdfgdfsgdfsg dfg dfgdfgdfg d &  &  &  &  &  &  &    \\ \hline
&gfdgdfgdf  fgdfgdf sdfgg   &  &  &  &  &  &  &    \\ \hline
&  dfgfdg dfgdfg dffgdfg &  &  &  &  &  &  &    \\ \hline
&  dfgdfgd dfgdfg dfgdfg&  &  &  &  &  &  &    \\ \hline
& fgdfg dffgdfgdf dffgdf  &  &  &  &  &  &  &    \\ \hline
&  dfgdfgd dfgdfg dfgdfg&  &  &  &  &  &  &    \\ \hline
& fgdfg dffgdfgdf dffgdf  &  &  &  &  &  &  &    \\ \hline
& fgdfg dffgdfgdf dffgdf  &  &  &  &  &  &  &    \\ \hline
&gfdgdfgdf  fgdfgdf sdfgg   &  &  &  &  &  &  &    \\ \hline
&  dfgfdg dfgdfg dffgdfg &  &  &  &  &  &  &    \\ \hline
&  dfgdfgd dfgdfg dfgdfg&  &  &  &  &  &  &    \\ \hline
& fgdfg dffgdfgdf dffgdf  &  &  &  &  &  &  &    \\ \hline
\end{longtable}
\egroup
\end{minipage}
\end{table}
\end{document}


PS: pardon for using some packages which are not useful here

Attached is the screenshot of what I am getting as an output.

## marked as duplicate by gernot, Zarko, Guilherme Zanotelli, Werner tables StackExchange.ready(function() { if (StackExchange.options.isMobile) return; $('.dupe-hammer-message-hover:not(.hover-bound)').each(function() { var$hover = $(this).addClass('hover-bound'),$msg = $hover.siblings('.dupe-hammer-message');$hover.hover( function() { $hover.showInfoMessage('', { messageElement:$msg.clone().show(), transient: false, position: { my: 'bottom left', at: 'top center', offsetTop: -7 }, dismissable: false, relativeToBody: true }); }, function() { StackExchange.helpers.removeMessages(); } ); }); }); Dec 13 '16 at 16:26

• Hi, welcome. If you know that some packages are not useful/relevant, why not just remove them from the example? And by the way, the whole point of a longtable is that it can break across pages, when you put it inside a minipage page breaks are no longer possible. – Torbjørn T. Dec 13 '16 at 14:12
• Use e.g. the csvsimple package. Then you can convert a csv file to a tabular with a single command. – gernot Dec 13 '16 at 14:28
• Oops, didn't notice that you have a table environment as well. That also needs to go. And you probably want to remove the negative vspaces. – Torbjørn T. Dec 14 '16 at 7:20