I produce websites for a lot of school’s in and around Cape Town. It’s something I started doing when I was in High School, and it’s kinda stuck.
Last night I received a Word document with pages of teacher’s names and email addresses for a website. As I looked at it I imagined the huge amount of time I was about to waste either in a WYSIWYG editor or copying and pasting HTML tags.
Then I remembered that I had a B.Sc and more than 2 brain cells. I moved the Word Table to iWork Numbers (Excel would have worked just as well), exported the file as a CSV document, pulled open Textedit and wrote a quick PHP-CLI script to suck in the CSV and output the relevant HTML.
Hope it’s useful to someone else out there!
#!/usr/bin/php $job: ".htmlspecialchars($name)."
n"; } ?>
what fun!
more than 2 brain cells, haha – thats about right.
pretty cool script
Be glad you received it in a nice format. Plenty times people have sent me PDFs for which text extraction screws things up. Scripting is still doable (and I do it cause it’s still quicker than manual), but a PITA.
Be glad that your CSV is in that format. You can have things in quotes, then writing your own parser can be a bit of a bitch.
You should of used the standard python module CSV