Import CSV file to table in Nisus?

Everything related to our flagship word processor.
Post Reply
withoutFeathers
Posts: 140
Joined: 2013-03-19 16:22:50

Import CSV file to table in Nisus?

Post by withoutFeathers »

Hi,
I'm accumulating CSV files (as backups for meta-data for pieces of writing submitted to publishers).

I'd like a way to get these into Nisus, converted into a Nisus Table.

So far I can only get them to load in the bare text CSV form, and 'convert to Table' doesn't turn them into a proper table with rows and columns that split at the commas -- instead there's just a single column.

In other words, I want a table that gives a column for each field, with the title at the top of the column.

In another thread Martin provided a macro for someone who was asking for CSV to be made into a Glossary.

See:
https://nisus.com/forum/viewtopic.php?f ... CSV#p20811


This must be very similar; perhaps someone could make a macro that would make the CSV into a vanilla-variety Table?
Or is there some other solution?

Thanks

wF
adryan
Posts: 563
Joined: 2014-02-08 12:57:03
Location: Australia

Re: Import CSV file to table in Nisus?

Post by adryan »

G'day, wF et al

If you replace all the commas in your comma-separated text file with tabs, then select everything and Convert Text to Table, you will get a proper Table.

This may not be the complete solution in every circumstance. For example, I started with a Numbers spreadsheet which had commas in some of the cells. When I exported it to CSV, the contents of those cells, including the original commas, were enclosed in quotation marks. Replacing all commas with tabs in such a situation does not give you what you want. In such situations, one could replace commas in the original (pre-CSV) text with some placemarker character or string which could be converted back to commas in the final NWP Table. (But of course, Numbers can export to tab-separated text directly, or one can simply copy and paste a slab of spreadsheet into NWP to get a Table without having to worry about special commas.)

Cheers,
Adrian
MacBook Pro (M1 Pro, 2021)
macOS Ventura
Nisus Writer user since 1996
withoutFeathers
Posts: 140
Joined: 2013-03-19 16:22:50

Re: Import CSV file to table in Nisus?

Post by withoutFeathers »

adryan wrote: 2019-09-08 13:47:53 G'day, wF et al

If you replace all the commas in your comma-separated text file with tabs, then select everything and Convert Text to Table, you will get a proper Table.

This may not be the complete solution in every circumstance. For example, I started with a Numbers spreadsheet which had commas in some of the cells. When I exported it to CSV, the contents of those cells, including the original commas, were enclosed in quotation marks. Replacing all commas with tabs in such a situation does not give you what you want.
Adrian
Hi Adrian,

Right, I thought of that, but realised that replacing commas would replace commas in the text in the fields.

But I've stumbled on a solution: Open Office. :)

In case anyone else want to do this, method is simple:
1. Open the .csv file in Open Office "Open File" dialog.
2. This brings up a dialog that gives options for delimiters (including comma) and a handy option to treat 'quoted fields as text'; choose this. This solves the problem Adrian identified. [Note that the default checkmarks in this dialog box are wrong, so it's necessary to change them].
3. Now the .csv data appears in the Open Office Calc spreadsheet, with title and rows lined up nicely.
4. Copy all the cells, then paste into Nisus document.
5. Nisus now has it as a table.

wF
Post Reply