/    Sign up×
Community /Pin to ProfileBookmark

Grab some value from html to excel

Hi,

I have a question, I have an old list of my customers saved in html ( form ) but now I need them in excel

for example:

[code=html]<legend>test</legend>
<div class=”tableline”>
<label>Member ID</label>
<input class=”input” type=”text” [COLOR=”Red”]name=”member_id” value=”25547″[/COLOR] readonly=”readonly” disabled=’disabled’ />
</div>
<div class=”tableline”>
<label>Registered date</label>
<input class=”input” type=”text” [COLOR=”red”]name=”date” value=”2010-06-22″[/COLOR] readonly=”readonly” disabled=’disabled’ />
</div>
</fieldset>[/code]

in above example i need Member ID and Registered Date’s Values, but there is thousands of these values and I need them organised in excel like below:

[B]Member ID Name Surname Registered Date
25547 john brown 2010-06-22[/B]

is there a way to do it for 10000 of these values automatically?

Thank you in advance

Regards,
Mehran

to post a comment
HTML

8 Comments(s)

Copy linkTweet thisAlerts:
@xeteaOct 27.2010 — It's possible with some text-editing and some Php.

Are all your customers in the same form tag? In that case you're gonna have to replace all 'name="member_id"' with 'name="member_id[]"' (and also for date). Like this:
[code=html]<div class="tableline">
<label>Member ID</label>
<input class="input" type="text" name="member_id[]" value="25547"readonly="readonly" disabled='disabled' />
</div>
<div class="tableline">
<label>Registered date</label>
<input class="input" type="text" name="date[]" value="2010-06-22" readonly="readonly" disabled='disabled' />[/code]


Then submit that form to some php-script that converts it to excel. The excel-part is easy with PhpExcel: http://phpexcel.codeplex.com/
Copy linkTweet thisAlerts:
@mehranmahoutiauthorOct 27.2010 — Thank you for quick respond,

unfortunately each member has its own html file ( member1.html, member2.html, ...)

I am now downloading the phpexcel but I don't know how to use it, i will try to find. ( I am very new to coding )

Thank you again

Merhan
Copy linkTweet thisAlerts:
@xeteaOct 27.2010 — I'm just curious, why did you store member information in html files?

It should be possible to write some script that extracts the information from each file and saves it in an excel document as well. Consider it practise ?
Copy linkTweet thisAlerts:
@mehranmahoutiauthorOct 27.2010 — its not my idea to save them in html file ?

i have to try it but I am very new to coding and I don't know what can I do ?

thank you for your helps again
Copy linkTweet thisAlerts:
@xeteaOct 27.2010 — Was that a question?
Copy linkTweet thisAlerts:
@MSimmonsOct 30.2010 — Hey mehranmahouti,

There's a new web-based app called DocRaptor that will convert HTML to PDF for you. I think you get 5 free docs with their trial plan - might get you through. www.DocRaptor.com

Good luck!
Copy linkTweet thisAlerts:
@getbestproductOct 30.2010 — open the page on html, then copy the data to excel.
Copy linkTweet thisAlerts:
@CharlesOct 30.2010 — If you have PHP running locally on a Windows box then this is quite easy. The HTML you can read and parse and stumble through using DOMDocument. And you can easily write to Excel using COM. Something like:<i>
</i>$excel = new COM ('Excel.Application');
$excel-&gt;visible = true;
$workbook = $excel-&gt;workbooks-&gt;add();
$worksheet = $workbook-&gt;worksheets(0);

$dom-&gt;loadHTMLFile ($file_name);
$line_num = 1;
foreach ($dom-&gt;getElementsByTagName ('tr') as $tr) {
$col_num = 1;
foreach ($tr-&gt;getElementsByTagName ('td') as $td) $sheet-&gt;cells ($line_num, $cell_num++)-&gt;value = $td-&gt;firstChild-&gt;data;
$lineNum++;
}
×

Success!

Help @mehranmahouti spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...