Texstudio: Convert CSV to LaTeX tables

Created on 11 Jun 2018  Â·  8Comments  Â·  Source: texstudio-org/texstudio


Environment

  • TeXstudio: 2.12.9
  • Qt: ALL
  • OS: ALL
  • TeX distribution: ALL

Expected behavior

  • Provide a dialog to open a file (.csv, .tsv), specify a separator (,,;,:,\t,) and encoding
  • The chosen file is read and split into an array of data according to the separator
  • A LaTeX table is generated from the data and inserted in the .tex file

Actual behavior

N/A

How to reproduce

N/A

Note

This would be a nice feature requested by some collegues, too. I would be able to write the actual reader (file -> array) and generator (array -> TeX) but I cannot create the interfaces (dialog & stuff).

enhancement wontfix

Most helpful comment

You can easy to convert CSV To LaTeX Table at:https://tableconvert.com/

All 8 comments

Why not, but a more efficient way would be to use the pgfplotstable package.

Well the idea was actually to provide a more efficient way to create tables instead of embedding data.

The intended workflow is:

  1. Create the table using LibreOffice Calc (For instance a comparison of RTM implementations)
  2. Export the table to CSV
  3. Generate the LaTeX
  4. Forget the CSV
  5. Work with the LaTeX table

Also it might be even more useful to use spreadsheets (eliminates step 2) instead of CSV. But I looked up the spreadsheet formats and it would be really an huge amount of work.

Concerning this use case, the best would probably be a spreadsheet macro. With OpenOffice (and maybe LibreOffice), we could use Calc2LaTeX which used to work nicely, but that's not the case anymore. With Excel, one can use Excel2LaTeX which I was told it is working nicely.

Otherwise, they are online converters: http://tablesgenerator.com/ and http://truben.no/table/ (the former lets you paste data from a spreadsheet).

all/most of it could be handled via script ...

There are many different table packages and types in latex. It's not reasonably possible to support them. Natively in the editor.

Use a script instead and adapt it to your need. See this example for a simple starting point.

Note: You don't even need an intermediate .csv file. Just copy the data from your spread sheet application to the clipboard and trigger the macro to generate a table.

You can easy to convert CSV To LaTeX Table at:https://tableconvert.com/

With this one here http://www.tablesgenerator.com/ you can even import CVS files or tables from clipboard.

Using Linux I just call tr ',;\t' '&' on the CSV file in the terminal and then use cursor mirrors to add \\

Was this page helpful?
0 / 5 - 0 ratings

Related issues

homocomputeris picture homocomputeris  Â·  7Comments

mohammadsdtmnd picture mohammadsdtmnd  Â·  8Comments

jeanlucthumm picture jeanlucthumm  Â·  3Comments

philippwerner picture philippwerner  Â·  3Comments

kendonB picture kendonB  Â·  10Comments