Viewing .csv files as a spreadsheet/table

jasper.robinson's Avatar

jasper.robinson

20 Oct, 2021 02:08 PM

I'm processing some big .csv files (~12 'columns' x ~2000 'rows') and wondered if it's possible to view them in Marked2 as a table/spreadsheet? Ultimately, I need to end up with a .csv file with the same number of commas.

I've used regex in BBEdit to tidy the files up but there are some final tweaks that I need to do manually. It's pretty easy to see where I need to do this if I open in Numbers/Excel (but less easy to edit); if I use BBEdit/CotEditor it's easy to edit but not easy to see what I need to edit. So I thought that if I could drag a .csv into Marked2 and see contents in a spreadsheet format, I could edit in CotEditor—best of both worlds. But if I try this Marked2 just gives the .csv view (i.e., commas not columns).

Is there a setting or kind of CSS file that would achieve a spreadsheet view of .csv?

I took a look for .csv-related info here and saw mention of TableFlip. This looked good for creating tables but I really only want to view them. Nevertheless, I tried TableFlip on one of these files and it really didn't like it—too big, I assume.

  1. Support Staff 1 Posted by Brett on 20 Oct, 2021 04:21 PM

    Brett's Avatar

    Marked can't open CSV files directly, but if you include one using
    Marked's include syntax inside of a Markdown document, it will convert
    it to a MultiMarkdown table (viewable by both MMD and GFM processors). I
    haven't extensively tested this feature, but it works on most of the
    CSV's I have laying around. Marked watches included files for changes,
    so it will refresh the preview when the CSV file changes.

    In an empty Markdown file, just add a line like:

    <<[~/path/to/filename.csv]

    If the CSV is in the same folder as the Markdown file with the include,
    you don't need the path, just the filename.

    Caveats: The CSV->Table processing isn't terribly efficient, so massive
    CSVs will take a few seconds to load/refresh on change. Also, in testing
    this to make sure I was giving you good info, I did manage to crash
    Marked, so there's a bug in there somewhere that I haven't caught yet.
    Only happened once, though. If you do experience a crash while doing
    this, feel free to share a crash report :).

    -Brett

  2. 2 Posted by jasper.robinson on 20 Oct, 2021 05:14 PM

    jasper.robinson's Avatar

    Thanks Brett,

    I tried your trick with a really small .csv file. It appeared in Marked2 fairly promptly & edits that I made to the .csv file were updated after a few seconds. A little slower than with normal Markdown, but much quicker than opening in Numbers! (BTW, I’m on a 2018 Mac mini, 3 GHz 6-Core Intel Core i5, 16 GB 2667 MHz DDR4)

    I tried one of my bigger .csv files. It also opened in Marked2 fairly quickly and looked good. I tried updating the .csv file but the Marked2 rendering hasn’t updated after about 5 minutes. So this would stop it being useful to check if I needed an extra comma somewhere.

    I found that I could use the slider or ↑/ ↓ arrow to move around, which would be useful to check that things are lined up in correct columns. But on a second test, I accidentally selected some of Marked2’s cell. This threw Marked2 into a BeachBall tail spin and I needed to Force Quit it. I’ve attached the report in case it’s any use to you.

    Best wishes, Jasper

  3. Support Staff 3 Posted by Brett on 20 Oct, 2021 07:31 PM

    Brett's Avatar

    Any chance you could share one of your huge CSV files so I can test with
    it? I can give you a direct email if it's private but you're willing to
    share. Development on this lesser-known feature isn't top priority, but
    it would be nice to have something to battle test with when I get to
    it...

    -Brett

  4. 4 Posted by jasper.robinson on 21 Oct, 2021 06:54 AM

    jasper.robinson's Avatar

    Hello Brett,

    The files that I tested included people’s personal details but I fished out a similar file and reacted it ('Marked2bigCsvTriggersFreeze.csv’), which is attached along with its .md file.

    This one is actually more horrible than the one I’d tested yesterday in that it still has a lot of the unwanted commas/columns that I’d removed with regex/manually. I don’t know if this would really confuse Marked2, as such, but it would mean that the file was bigger in that it would have more columns than my original test (but about the same number of rows, ~1600).

    I just tested this retacted one too. It was worse. Marked2 crashed as soon as I dropped the .md file onto it in the Dock.

    One other thought I had was that yesterday’s crash could have been in part because I was working with files that were in iCloud. Marked2 could have been trying to work nicely but screwed up because syncing was in progress. I’ve noticed that iCloud is *very* slow, at the moment. Today’s test, was with ‘Marked2bigCsvTriggersFreeze.csv’ and its .md file, in my local drive so this will not have been subject to any iCloud syncing complications, but the crash still happened.

    Yesterday, I installed a free app from the Apple AppStore called ‘CSView’, yesterday. I’ve not tested it that rigorously yet, but it seems to do what I need: I can open a big .csv file and it’s displayed as a table/spreadsheet. Changes that I make to the big .csv aren’t visible immediately (like they are in Marked2 with md edits). Instead you need to sync/refresh the file in CSView, but it happens quickly enough to be useful. Maybe a useful suggestion for anyone else looking to do this.

    Best wishes, Jasper

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac