How to import a table from a csv file to TeXmacs?

It’s a large table so I don’t want to type it word by word.

The only solution that I see is writing a program in Scheme that does that; one could keep it simple and refine the appearance of the table in the TeXmacs editor if that is possible - and I do not know if it is, i.e. if one can edit elements that are generated via Scheme inside the editor; otherwise one would need to completely program the table in Scheme. Perhaps someone has a better answer.

As far as I know, currently, TeXmacs does not support CSV file import.

Well, it is a good feature request.

I wrote a small package that reads the contents of a csv file and formats them as a TeXmacs table; I placed it in https://github.com/pireddag/csvTable

It works (I have seen TeXmacs crash once while using it, but I do not know if the reason was the package), but it is too simple to be useful for a practical document, as the table is not formatted.

It could be extended quickly to a usable package if there were a way to insert the TeXmacs code generated by the Scheme code inside the TeXmacs document “as code” instead than “as typeset output” as it is now: in that way, one could import the csv file into a table, then format the table manually. Scheme typed into a Scheme session does that, I do not know how to do it with a package (I do not know if it is possible either).

thank you, I’ll try it

I have updated the program so that the table is also formatted. Please let me know if it works for you.

I think it will be possible to get a table formatted with cell backgrounds, spacings and lines according to your wishes (I am not able to change the color of the lines around the table cells). What I still do not know how to do is how to format the text inside the cells: for example make the text in the first column bold. But maybe I will be able to do that too.

To use the program it is necessary to set the security to Accept all scripts. As far as I understand it is a security risk (one could write a script to erase your hard drive), but it is a limited risk as the only damage can come from TeXmacs scripts that you install, so you are safe if you make sure that you install only safe scripts (@sadhen: am I understanding well?).

The one I am giving you seems completely safe to me.