Search code examples
csvlibreofficelibreoffice-basic

How to type big table in LibreOffice Writer?


Here is what I use.

    OS: Linux Mint 18
Editor: LibreOffice Writer 5.1.6.2

Situation

Consider the following foo.csv file (just example, the raw data contains hundred of lines):

A,B,C
1,2,3

To create a table in Writer with the data from foo.csv usually one creates the table via Toolbar and then type the contents (possibly using TAB to navigate between cells).

Here is the result of procedure above:

enter image description here

Goal: Since the whole foo.csv contains hundreds of lines, how to proceed?

1st try: copy and paste the data from foo.csv into the table does not work, as seen below.

enter image description here

2nd try: copy and paste the data from foo.csv into the table with all cells selected does not work, as seen below.

enter image description here

Question: is it possible to edit an odt file in some way to write some code (like we could do with tags in HTML) to produce such table?

Embed a Calc spreadsheet is not acceptable.


Solution

  • Just use the "Text to Table" feature:

    1. Insert the csv as "plain text" into your writer document (not into a table, just anywhere else);
    2. Select the inserted lines;
    3. Select Menu "Table" -> "Convert" -> "Text to Table";
    4. Adjust the conversion properties as needed (set separator to comma: Select "Other", enter a comma into the box at the right"):

    enter image description here

    1. Hit OK - LO Writer will convert the text content of your CSV into a nice Writer table.

    Please note that if you use this solution, there's nothing like a "connection" between the writer table and the csv data. Changing the csv won't affect the writer table. This would be possible only by embedding an object (but this won't result into a Writer table...).

    If the csv data is the only content of the odt (writer) file, there's another option: Use LibreOffice Base to create a LO Database using the csv file (dynamically updated if the csv changes), and use the Report feature to get a tabular output of the csv data. LO Base will store the output layout as report, making it easy to create an up-to-date report.