Jump to content

convert Html table to csv table


Recommended Posts

Please, is there a way to convert html table to a csv file ?

somme think like this

Func html_To_csv ($The_given_url, $separator,$output_csv_file) ;

URLDownloadToFile($The_given_url, $html_file)

$htmlCode=FileRead($html_file, FileSize($html_file))

..scan engine...

for each html table <Table> take only Cells values and separate tem with $separator ";"

........

Endfunc

Edited by supergg02
Link to comment
Share on other sites

I have a question, can you read? your in the scripts/scraps forum, and when you pressed the button it said "this is not a general support forum"

And to answer your question, you need to get very creative. Yes it is possible though, but you need to extract the table from the rest of the html first. Something you need to check though is amke sure a table is not nested when doing this.

Offering any help to anyone (to my capabilities of course)Want to say thanks? Click here! [quote name='Albert Einstein']Only two things are infinite, the universe and human stupidity, and I'm not sure about the former.[/quote][quote name='Wolvereness' date='7:35PM Central, Jan 11, 2005']I'm NEVER wrong, I call it something else[/quote]

Link to comment
Share on other sites

Side note, for stripping tags it gets messy. <td> usually starts a collum, and <tr> ends a line/starts a new row. you will have to take into consideration colspan and rowspan, and all the other useless things like <td width="100"> and such. All these can be done, and are not that hard, but have to be taken into account.

I usually parse out just the table I need (find what is between <table and </table.)

Next I stringsplit by <

if stringleft($infoline,2)="td" then

; new collum

$infoline=stringtrimleft($infoline,Stringintr($infoline,">"))

; finish off on your own

well ya get the approach.

honestly I do most of these with a regular expression editor to save time.

AutoIt3, the MACGYVER Pocket Knife for computers.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...