[Tex/LaTex] How to import data from excel and format it as text in LaTeX

big-listcsvcsvsimpleexcelexcel2latex

I have a big database spreadsheet on Excel which is a list of products and I want to use its data to write formatted text in LaTeX.

The table looks like this:
Year / Name product / Details
2000 / AAAAA / aaaaa
1975 / BBBBB / bbbbb
1998 / CCCCC / ccccc

I would like to use the data from this file in latex and get a text result resembling this (not a table):
2000 AAAAA, aaaaa
1975 BBBBB, bbbbb
1998 CCCCC, ccccc

What would be the best solution?
Should I use excel2latex, csvsimple, something else?
It reminds me of bibliography paper citations, but I've not been using LaTeX for years and I really don't remember anything useful at the moment.
I plan to start learning LaTeX again from scratch, but I thought that a very simple way of getting the result I want probably existed and that it would save me hours of research to ask to the community. ^^'

Best Answer

I'm back and I found a partial solution to my problem.
Please keep in mind that I am almost a complete beginner so I'm experimenting. ^^' (I'm using Overleaf to write my code because I tried on RStudio but the datatool package was apparently not available for R version 3.5.1)

So to simplify, this is the pattern I used:

% Load CSV database (here database.csv)
% and give it a label (here DB)
\DTLloaddb{DB}{database.csv}

%%%%%%%%%%%%%%%%
% Iteration
% Here in the D column I can have d1, d2, etc. 
% but I only want to display the result for the rows with d1:
\DTLforeach*[\DTLiseq{\D}{d1}] % Condition
 {DB} % Database label
{\A=A,\B=B,\C=C,\D=D,\E=E} % Assignment
{% Stuff to do at each iteration:
    \item[]
    \textbf{\A}
    \textbf{ \B}
    \textit{ \C}
    (\E)
}
%%%%%%%%%%%%%%%% 

In my particular situation, I am doing a wine list/menu (Carte des Vins) and eventually I want to:

1) sort them by wine (Bordeaux / Burgundy / Port / Rest of the World)
For now I'm using a csv file with only the Bordeaux wines (bordeaux.csv) but ultimately I would like to use a file with all the wines on it (wine.csv)

2) sort them by type (Red / White / Sweet white)
As you will see below, I managed to do that, but maybe there is a better way to do the same thing.

3) format the text as follows:
Vintage Name, Classification (Origin)
ex: 2009 Château Grand Village, Bordeaux Supérieur (Bordeaux)
The only thing that I have trouble with is the comma, because when the Classification column is empty I don't want to get "Vintage Name," with a useless comma... So for now I left the text without a comma.

So this is my whole code:

\documentclass[12pt]{article}
\usepackage[utf8]{inputenc}

% Pour modifer les marges
\usepackage{geometry}
% Marges du document 
\geometry{hmargin=2.5cm,vmargin=1.5cm}


% To remove the heading of the table of contents ("Contents")
\makeatletter
\renewcommand\tableofcontents{%
    \@starttoc{toc}%
}
\makeatother

% To make itemized lists
% This package provides user control over the layout of the three basic list 
% environments: enumerate, itemize and description. It supersedes both enumerate 
% and mdwlist (providing well-structured replacements for all their funtionality), 
% and in addition provides functions to compute the layout of labels, and to 
% ‘clone’ the standard environments, to create new environments with counters of 
% their own.
\usepackage{enumitem}

% Datatool package to load external files (cdv)
\usepackage{datatool}

\Huge\title{Carte des Vins}
\author{Buck's}
\date{September 2018}

\begin{document}
    \maketitle
    \tableofcontents

%--------------------------%
\newpage
\section{Bordeaux} 

% Load CSV database and give it a name
\DTLloaddb{BOR}{bordeaux.csv}

    \subsection{Red}
%%%%%%%%%%%%%%%%
% Iteration
\DTLforeach*[\DTLiseq{\Type}{Red}] % Condition
 {BOR} % Database label
{\Vintage=Vintage,\Name=Name,\Classification=Classification,\Type=Type,\Origin=Origin} % Assignment
{% Stuff to do at each iteration:
    \item[]
    \textbf{\Vintage}
    \textbf{ \Name}
    \textit{ \Classification}
    (\Origin)
}
%%%%%%%%%%%%%%%% 

    \subsection{White}
%%%%%%%%%%%%%%%%
% Iteration
\DTLforeach*[\DTLiseq{\Type}{White}] % Condition
 {BOR} % Database label
{\Vintage=Vintage,\Name=Name,\Classification=Classification,\Type=Type,\Origin=Origin} % Assignment
{% Stuff to do at each iteration:
    \item[]
    \textbf{\Vintage}
    \textbf{ \Name}
    \textit{ \Classification}
    (\Origin)
}
%%%%%%%%%%%%%%%% 

    \subsection{Sweet White} 
%%%%%%%%%%%%%%%%
% Iteration
\DTLforeach*[\DTLiseq{\Type}{Sweet white}] % Condition
 {BOR} % Database label
{\Vintage=Vintage,\Name=Name,\Classification=Classification,\Type=Type,\Origin=Origin} % Assignment
{% Stuff to do at each iteration:
    \item[]
    \textbf{\Vintage}
    \textbf{ \Name}
    \textit{ \Classification}
    (\Origin)
}
%%%%%%%%%%%%%%%%


%--------------------------%
\newpage
\section{Burgundy} 
    \subsection{Red}
    \subsection{White}

%--------------------------%
\newpage
\section{Rest of the World} 

%--------------------------%
\newpage
\section{Port}

%--------------------------------

\end{document}

And this is what I managed to get so far (this is the beginning of my section "Bordeaux" and of my subsection "Red"): This is the beginning of my section "Bordeaux" and of my subsection "Red"