+ Reply to Thread
Results 1 to 8 of 8

Thread: Htm2Csv.vdm : convert an html table to a csv file

Hybrid View

  1. #1
    Senior Member
    Join Date
    Aug 2011
    Location
    British Columbia, Canada
    Posts
    383

    Htm2Csv.vdm : convert an html table to a csv file

    Hi Peter,

    Okay, I have written the macro, you requested. Htm2csv.vdm converts a html table to a csv file.

    To use:

    1. load html file into vedit
    2. position text cursor on a line ABOVE the line containing the table tag
    3. execute htm2csv.vdm
    4. save-as the output to a filename with a .csv extension
    5. load new csv file into MS Excel
    6. highlight all text
    7. on Home tab, select format, and then auto-fit column width
    8. on Home tab, select Find & Select, then select replace
    9. in Find what:, put [comma]
    10. in Replace with: put an actual comma symbol
    11. select Replace All
    12. save file

    You might want to copy & paste these instructions into a local text file.

    Let me know if this works for you.

    Hope others also find this useful.

    Comments, bug report, etc welcomed!

    Scott
    Attached Files Attached Files
    Last edited by Scott Lambert; March 14th, 2015 at 12:48 PM.
    Using Vedit 6.21.3, (32 bit), dated 9/12/11 running on Windows 7 (64 bit).

  2. #2

    Convert HTML table into tab delimited text file.

    I used to use a macro to extract data from html tables.
    This produces tab delimited text file, but could be converted.

    (These days I use Python Beautiful Soup)


    // HTML-TAB.VDM - Convert HTML table into tab delimited text file.
    //
    // Convert HTML table to tab delimited format
    // Allows multiple tables <TABLE ... </TABLE
    // Strips all HTML tags <...> from a file, creating a normal
    // text file. Assumes each "<" has a matching ">" on the same
    // line or the next line. Treats "\<" and "\>" as literal chars.
    //

    This is on my web site http://binnie.id.au/Downloads/Html_tab.vdm
    Ian Binnie

  3. #3
    Senior Member
    Join Date
    Nov 2014
    Location
    Minneapolis, MN
    Posts
    290
    Quote Originally Posted by ian binnie View Post
    I used to use a macro to extract data from html tables.
    This produces tab delimited text file, but could be converted.

    (These days I use Python Beautiful Soup)


    // HTML-TAB.VDM - Convert HTML table into tab delimited text file.
    //
    // Convert HTML table to tab delimited format
    // Allows multiple tables <TABLE ... </TABLE
    // Strips all HTML tags <...> from a file, creating a normal
    // text file. Assumes each "<" has a matching ">" on the same
    // line or the next line. Treats "\<" and "\>" as literal chars.
    //

    This is on my web site http://binnie.id.au/Downloads/Html_tab.vdm


    Thanks Ian,

    I just noticed that your macro works very nicely with Scott's Addcol.vdm. In other
    words, I just noticed that to use Addcol.vdm, I have to highlight the column on which I wish to perform the addition. In other words, the translated table should be in tab delimited format.

    I do hope that Ted will include your macro in a future release of Vedit.


    -peter

  4. #4
    Many years ago I wrote a macro to convert HTML table into tab delimited text file. I would be easy to convert to csv if required. (Now I use Python Beautiful Soup.)


    // HTML-TAB.VDM - Convert HTML table into tab delimited text file.
    //
    // Convert HTML table to tab delimited format
    // Allows multiple tables <TABLE ... </TABLE
    // Strips all HTML tags <...> from a file, creating a normal
    // text file. Assumes each "<" has a matching ">" on the same
    // line or the next line. Treats "\<" and "\>" as literal chars.
    //

    This can be downloaded from my website
    http://binnie.id.au/Downloads/Html_tab.vdm
    Ian Binnie

  5. #5
    Many years ago I wrote a macro to convert HTML table into tab delimited text file. I would be easy to convert to csv if required. (Now I use Python Beautiful Soup.)


    // HTML-TAB.VDM - Convert HTML table into tab delimited text file.
    //
    // Convert HTML table to tab delimited format
    // Allows multiple tables <TABLE ... </TABLE
    // Strips all HTML tags <...> from a file, creating a normal
    // text file. Assumes each "<" has a matching ">" on the same
    // line or the next line. Treats "\<" and "\>" as literal chars.
    //

    This can be downloaded from my website
    Ian Binnie

  6. #6

    Htm2Csv vdm convert an html table to a csv file

    I have to convert html to csv to finally import with Anki

    It is not a table. Are words of the dictionary.

    Please can you explain how to prepare the first line with the first word ?


    Best Regards

    HTML Code:
    I recommend best forex trading system for profitable business

  7. #7
    Senior Member
    Join Date
    Nov 2014
    Location
    Minneapolis, MN
    Posts
    290
    Thanks Scott,

    It works very nicely. I do hope that Ted will include it in a future release of Vedit.

    -peter

  8. #8
    Administrator
    Join Date
    Aug 2011
    Location
    Ann Arbor, MI
    Posts
    103
    Please give me a link to a website with a suitable table for testing this macro.
    Thanks.
    Ted.

+ Reply to Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts