Sign in to follow this  
Followers 0
jezsmith

Saving HTML as CSV

3 posts in this topic

I am interested in knowing, how to accomplish this task.

Its becoming quite a headache so, any help is wonderfully appreciated.

Basically, all I want is to be able to navigate to a HTML page (actually a report coded in PHP), but outputs into HTML.

Its a table consisting of like the following:

<html>
<head>
<title>Shopping Cartridge World : X Cart : Purchasing Report</title>
</head>

<body>

<h3>Shopping Cartridge World : X Cart : Purchasing Report</h3>

<table border=0 width="80%" cellpadding="4"><tr><td>Advent Vender Code</td><td>Product Code</td><td>Product</td><td>Cost Price</td><td>Quantity</td><td>Total</td><td>Date</td></tr><tr><td>HPC4800A</td><td>C4800A</td><td>HP 10 Black Printhead</td><td>42.16</td><td>4</td><td>84.32</td><td>18/9/2009</td></tr><tr><td>HPC1809A</td><td>C1809A</td><td>HP DesignJet 2800/3800cp Yellow Dye Ink Cartridge 410ml</td><td>91.94</td><td>1</td><td>91.94</td><td>18/9/2009</td></tr><tr><td>HPC1807A</td><td>C1807A</td><td>HP DesignJet 2800/3800cp Cyan Dye Ink Cartridge 410ml</td><td>91.94</td><td>1</td><td>91.94</td><td>18/9/2009</td></tr><tr><td>HPC1808A</td><td>C1808A</td><td>HP DesignJet 2800/3800cp Magenta Dye Ink Cartridge 410ml</td><td>91.94</td><td>2</td><td>183.88</td><td>18/9/2009</td></tr><tr><td>HPC4844A</td><td>C4844AE</td><td>HP 10 Black Ink Cartridge 69ml</td><td>19.66</td><td>2</td><td>39.32</td><td>18/9/2009</td></tr></table>

<table>

<tr>
<td colspan=2>&nbsp;</td>
</tr>
<tr>

<td><a href="#" onclick="history.go(-1)">Back</a></td>
<td><a href="http://shopping.cartridgeworld.co.uk/purchasing/purchase_Export.php">Export CSV</a></td>
</tr>
</table>

<table>
<tr>
<td>
<form name="purchase_cmpt" id="purchase_cmpt" method="POST" action="ordersallComplete.php">
<input type="hidden" name="status" id="status" value="C" />

<input type="submit" id="submit" name="submit" value="Complete All Orders" />
</form>
</td>
</tr>
</table>

</body>
</html>

Only this could have multiple rows, so must include all rows.

It is only the following I am interested in getting though:

<table border=0 width="80%" cellpadding="4"><tr><td>Advent Vender Code</td><td>Product Code</td><td>Product</td><td>Cost Price</td><td>Quantity</td><td>Total</td><td>Date</td></tr><tr><td>HPC4800A</td><td>C4800A</td><td>HP 10 Black Printhead</td><td>42.16</td><td>4</td><td>84.32</td><td>18/9/2009</td></tr><tr><td>HPC1809A</td><td>C1809A</td><td>HP DesignJet 2800/3800cp Yellow Dye Ink Cartridge 410ml</td><td>91.94</td><td>1</td><td>91.94</td><td>18/9/2009</td></tr><tr><td>HPC1807A</td><td>C1807A</td><td>HP DesignJet 2800/3800cp Cyan Dye Ink Cartridge 410ml</td><td>91.94</td><td>1</td><td>91.94</td><td>18/9/2009</td></tr><tr><td>HPC1808A</td><td>C1808A</td><td>HP DesignJet 2800/3800cp Magenta Dye Ink Cartridge 410ml</td><td>91.94</td><td>2</td><td>183.88</td><td>18/9/2009</td></tr><tr><td>HPC4844A</td><td>C4844AE</td><td>HP 10 Black Ink Cartridge 69ml</td><td>19.66</td><td>2</td><td>39.32</td><td>18/9/2009</td></tr></table>

Can I get autoit to save the table data above as a CSV file?

If so can someone help me with this as I am a little confused as to how to actually acheive this efficiently as it where?

I must emphesise this is a report that can have multiple rows and I appreciate any help given in advance.

Thanks,

Jeremy.

Share this post


Link to post
Share on other sites



Use _StringBetween() to parse such data.

as start use <ttable and as end use </table> - for table

as start use <tr> and as end use </tr> - for rows

as start use <td> and as end use </td> - for columns

Share this post


Link to post
Share on other sites

Isn't this better posted in another forum area? Because in terms of AutoItX/COM interface, you could really do the HTML to CSV conversion from other languages like VBScript or C++ or C#/VB.NET. Because this forum more or less assumes you are using AutoIt via the COM/DLL interface, not AutoIt script.

Share this post


Link to post
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
Sign in to follow this  
Followers 0