WordPress.org

Ready to get started?Download WordPress

Forums

TablePress
[resolved] Importing links from Google Docs (12 posts)

  1. vector40
    Member
    Posted 1 year ago #

    Hey there,

    I'm importing a spreadsheet from Google Docs; every cell in one of the columns is intended to be a link, and not a raw URL (in other words, an HTML-style link with distinct text linking to a URL). This is a large number of links. I have them set up as links in Docs (already something of a pain, since they hardly support it, but never mind), but when I import to TablePress, they're lost.

    I'm importing as .csv, which is the only shared format between Docs and TablePress; I realize that as things stand, support for link carry-over is not present. So I'm left to manually re-linkify them in the UI, which is very slow work. Is there some kind of automated approach, work-around, or other brilliant solution to this dilemma, or am I simply stuck plugging things in by hand?

    Thanks a million...

    http://wordpress.org/extend/plugins/tablepress/

  2. TobiasBg
    Member
    Plugin Author

    Posted 1 year ago #

    Hi,

    thanks for your question.

    The problem here is not that the links are lost during the import into TablePress, but actually already during the export to CSV from Google Docs. So, this is not TablePress' fault. You should be able to verify this by checking the CSV file in a text editor. It will not contain the HTML code for links.

    Fortunately, I know a solution to this, so that you will not have to manually "re-linkify" them :-) There's a TablePress Extension that can be used to turn all URLs in to clickable links. Please see http://tablepress.org/extensions/automatic-url-conversion/ for more information.

    Regards,
    Tobias

  3. vector40
    Member
    Posted 1 year ago #

    Yep, I know, but there's no other format that's cross-compatible (any chance of supporting HTML imports?)

    The problem with the conversion extension is that I don't just have URLS that I want to linkify; I have English text linking to a different URL (i.e. This is the link), and I don't know of a way to have that convert automatically.

  4. TobiasBg
    Member
    Plugin Author

    Posted 1 year ago #

    Hi,

    HTML imports are supported! Just check the "Import" screen :-)
    This must be valid code for an HTML table though.

    Yes, that Extension can only linkify URLs. If you have links with text, you'll have to re-create those in TablePress, or get Google Docs to export them as HTML code.

    Regards,
    Tobias

  5. vector40
    Member
    Posted 1 year ago #

    Sadly I only get errors when I try to import HTML from Docs -- I don't think the formats get along.

    At this point I'm resigned to manually linkifying, but there's another problem. This will be a table that frequently gets updated. If each time, I export from Docs and reimport the table into TablePress, it will overwrite any links I've manually created, and I'll have to go redo them all, won't it? Is there some way when I import to have the contents added rather than completely overwrite the previous table?

  6. TobiasBg
    Member
    Plugin Author

    Posted 1 year ago #

    Hi,

    thanks for the update -- and sorry that this also didn't work :-( Yes, then the formats really don't get along :-(

    Yes, if you re-import a table, it will overwrite all existing content and modifications. After the import, the table will have only the contents from the import. You would have to re-linkify the links.
    Having content added/appended rather the overwriting the table is not possible, unfortunately :-( Sorry. As a workaround, you could export the table from TablePress (to a CSV file), and to the appending manually in a text editor (with the CSV data from the Google Docs export). Then you can re-import that merged file, which will contain all of your previous data (with linkified links), and the new data (which still needs to be linkified).

    Regards,
    Tobias

  7. vector40
    Member
    Posted 1 year ago #

    I think I've found a workaround. If I export from Docs in HTML, I'm able to open that file using Excel, preserving the links... and I can then export from Excel to HTML, and TablePress successfully opens this with links intact. Presumably Excel is exporting cleaner HTML.

    I'm encountering another problem now, however. One of my columns is a numerical count, and when you attempt a user-initiated sort from the output table, it seems to be sorting that column alphabetically rather than numerically (that is, 382 is "before" 43 which is before 9). Is there something I need to do in order to instruct DataTables to interpret this correctly? A few rows in the column do have text in them instead (NA or the like); if that could be causing the problem I can probably find a way to avoid that.

    Thanks for all the help.

  8. TobiasBg
    Member
    Plugin Author

    Posted 1 year ago #

    Hi,

    that workaround sounds good :-) Happy to hear that you found that! Indeed, Excel is presumably creating better HTML then (but not always, from my experience).

    About the sorting: You are right, this is caused by the cells like "NA" or other texts. Due to those cells, the column is not detected as "numeric", but as "string", which has a different sorting behavior. You will need to change all cells that are not numbers.

    Regards,
    Tobias

  9. vector40
    Member
    Posted 1 year ago #

    Tobias,

    I'm stumped -- one of my columns is again failing to sort numerically, and I can't see why. All I have are numbers in there from 0 through some various thousands -- the header alone is alphanumeric, but that's not causing problems in other columns.

    See: http://emsbasics.com/digital-research-library/spinal-immobilization/

    The "Size" column is sorting as strings.

    Thoughts?

  10. TobiasBg
    Member
    Plugin Author

    Posted 1 year ago #

    Hi,

    the problem here is that all of your table cells have a line break at the end. These get converted to HTML <br /> automatically. And those then force the sorting data type to be a string and not a number.

    My assumption is that you imported this table from a CSV file, right?
    In that case, it should be the best to open the file in a text editor and to remove all line breaks via search/replace.
    Another idea (that only works if no line breaks have been added on purpose), would be to extend the table's Shortcode to

    [table id=9 convert_line_breaks=false /]

    Regards,
    Tobias

  11. vector40
    Member
    Posted 1 year ago #

    Aaah, brilliant! You're a wizard. It was imported from HTML.

  12. TobiasBg
    Member
    Plugin Author

    Posted 1 year ago #

    Hi,

    no problem! You are very welcome! :-)
    Great to hear that this helped!

    Best wishes,
    Tobias

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

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic