• Resolved frequentmiler

    (@frequentmiler)


    I have a very large CSV that contains HTML fragments in many cells. This hasn’t been a problem before, but now I’ve added HTML tables within some of the cells and I can’t get the CSV to import correctly. Now, rather than importing the whole CSV, Tablepress imports only the contents of the first HTML table that it finds within the CSV.

    Is there a workaround?

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Tobias Bäthge

    (@tobiasbg)

    Hi,

    thanks for your post, and sorry for the trouble.

    I haven’t directly tested this myself, but I can see that this could indeed cause problems for the import, because the detection of HTML tables (specifically the HTML <table> tag) gets precedence over the CSV import (which is kind of like a last resort here, because pretty much everything can be interpreted as a CSV file, with a bit of good will…).

    As for a quick workaround, you could maybe try opening the CSV file in Excel and then save that as an .xlsx file and import that into TablePress. As an alternative, you could (at least temporarily) return to using the “old” import engine of TablePress, where CSV is tried to be imported before the HTML format. That is possible by adding the line

    add_filter( 'tablepress_use_legacy_table_import_class', '__return_true' );

    to the end of your theme’s “functions.php” file.

    Now, a remark: HTML tables inside the cells of an HTML table? Do you really need such nesting? What are you trying to achieve with that?

    Regards,
    Tobias

    Thread Starter frequentmiler

    (@frequentmiler)

    Thanks! I tried the Excel workaround, but I got an error each time I tried to import it. I’m not too excited about the idea of using an old import engine, so instead we’re looking into changing the tables to DIVs to get around this issue.

    I know its weird, but we manage data about credit cards in a Google Docs sheet and we put all that info into tablepress in a way that displays lots of information nicely within each cell. You can see one use of this here: https://frequentmiler.com/best-credit-card-sign-up-offers/

    Plugin Author Tobias Bäthge

    (@tobiasbg)

    Hi,

    thanks for the example! I can see what you are doing now. Indeed, the best solution for the long term would be to directly use more appropriate HTML structures here. HTML Tables should be used for tabular data, and not for layout purposes like this.

    (In the mean time, don’t be afraid to use that “old” import engine: It will be part of TablePress for the foreseeable future, it just won’t get new features/enhancements, like support for other data formats, etc.)

    Best wishes,
    Tobias

    Thread Starter frequentmiler

    (@frequentmiler)

    We have it all working now, but the table first displays without CSS formatting and then formats after a few seconds. You can look at the link I posted previously to see that happen. Can you think of any way around that? Can we somehow force the styling to apply while the table loads or keep the table from displaying until the styling is complete?

    Plugin Author Tobias Bäthge

    (@tobiasbg)

    Hi,

    I can’t seem to reproduce this. For me, the styling appears immediately (unless I’m looking at the wrong page or table)?

    Also, I can’t really see what would be causing such behavior, as all CSS files are included properly, from what I can see.

    Regards,
    Tobias

    Thread Starter frequentmiler

    (@frequentmiler)

    I’m sorry about wasting your time! Over the weekend, we fixed this by moving the css to load earlier. I didn’t have a chance to come here to update this until now.

    Plugin Author Tobias Bäthge

    (@tobiasbg)

    Hi,

    ah, no problem! Good to hear that everything is working!

    Best wishes,
    Tobias

    P.S.: In case you haven’t, please rate TablePress here in the plugin directory. Thanks!

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Import CSV that contains HTML tables’ is closed to new replies.