CARVIEW |
Archive: Excel
September 5, 2008
Read Excel files in Perl and PHP
Relational databases that speak SQL are the data-storage backbone for most developers. Unfortunately, but most of the data that's created outside the control of the technology caste at a typical workplace is in Excel format. Because of this, being able to procedurally read and write Excel documents with a familiar language can open up a whole world of possibilities for automation and data migration.
Assuming you're attempting to read and write standard text (Ie. not binary/graphic) data from Excel worksheets, this is actually fairly doable in PHP and Perl.
A recent article by Mike Diehl at Linux Journal peaked my interest in this. He shows off some of the features of the Spreadsheet::ParseExcel Perl module, which can be used to pull data and even formatting information from cells in an Excel worksheet. Once you have your hands on the data, you can do what you want with it: output it to XML, toss it in a database for subsequent querying, or even convert it into other Excel documents (oh, the shame).
Perl Excel Libraries and Information
Spreadsheet:ParseExcel - Read from Excel 95/97/2000 documents
Spreadsheet:WriteExcel - Write to Excel 97/2000/2002/2003 documents
Linux Journal - Reading Native Excel Files in Perl
There are libraries for dealing with native Excel files in PHP as well. The following two seem to be the only options for binary Excel documents.
PHP Excel Libraries
PHP Excel_Reader - Read Excel 95 and 97 documents
Spreadsheet_Excel_Writer - Write Excel 5.0 documents
Reading and Writing Spreadsheets with PHP
With the most recent version of Excel, there is an XML file format option that will allow you to read and write data in a worksheet by directly interacting with the saved file's DOM. IBM has a document that details doing this with PHP, and it would be straightforward to apply this technique to Perl as well.
Read/Write XML Excel Data in PHP
Finally, if all you need to do is output a document that can be read in Excel, a standard CSV-format file will usually do the trick. Escaping can be a bit tricky, however, and my preferred format has become a plain-old HTML table. Just create a file that contains a TABLE element (no BODY or HTML tags necessary), with any number of TR rows and html-escaped data in the TDs, and save it out. If you use the XLS file extension, it will open directly in Excel with a double-click and Excel never seems to mind reading in the data.
Do you have any other Excel programming hacks? Give us a shout in the comments.
Posted by Jason Striegel |
Sep 5, 2008 08:23 PM
Data, Excel, PHP, Perl |
Permalink
| Comments (1)
| TrackBack
| Digg It
| Tag w/del.icio.us
March 6, 2008
Microsoft Excel 3D engine
Peter Rakos wrote an article for Gamasutra today which demonstrates how to hack yourself a simple 3D engine by subverting an Excel worksheet. It's not going to win any FPS awards, but the fact that you can even get Excel to draw raw shapes blows my mind.
In his demo, the worksheet is used to calculate values for all the polygon vertices and a very small macro loop draws the resulting mesh to the screen.
After downloading the source XLS, run the demo by hitting alt-F8 (option-F8 in Mac Excel). You'll find the code under the "Tools->Macro->Macros" menu.
Microsoft Excel: Revolutionary 3D Game Engine - Link
Peter's Example 3D Excel files - Link
Posted by Jason Striegel |
Mar 6, 2008 08:14 PM
Excel, Gaming, Software Engineering |
Permalink
| Comments (0)
| TrackBack
| Digg It
| Tag w/del.icio.us
February 28, 2008
Excel Hacks: Display a "please wait" message
Here's Hack #111, Display a "Please Wait" Message, from David and Raina Hawley's Excel Hacks, 2nd Edition. Millions of users create and share Excel spreadsheets every day, but few go deeply enough to learn the techniques that will make their work much easier. Yet there are many ways to take advantage of Excel's sophisticated capabilities without spending hours on advanced study. In Excel Hacks, you'll learn how to:
- Reduce workbook and worksheet frustration--manage how users interact with worksheets, find and highlight information, and deal with debris and corruption.
- Analyze and manage data--extend and automate these features, moving beyond the limited tasks they were designed to perform.
- Hack names--learn not only how to name cells and ranges, but also how to create names that adapt to the data in your spreadsheet.
- Get the most out of PivotTables--avoid the problems that make them frustrating and learn how to extend them.
- Create customized charts--tweak and combine Excel's built-in charting capabilities.
- Hack formulas and functions--subjects range from moving formulas around to dealing with datatype issues to improving recalculation time.
- Make the most of macros--including ways to manage them and use them to extend other features.
- Use the enhanced capabilities of Microsoft Office 2007 to combine Excel with Word, Access, and Outlook.
Hack #111: Display a "Please Wait" Message - Link
Related:
- Excel Hacks, 2nd Edition @ the Maker Store - Buy now
- Excel Hacks, Second Edition--New from O'Reilly: Hook Up with Excel Expert Hackers - Press Release
Posted by Brian Jepson |
Feb 28, 2008 12:00 PM
Excel, Excerpts, Hacks Series |
Permalink
| Comments (0)
| TrackBack
| Digg It
| Tag w/del.icio.us
February 27, 2008
Excel Hacks: Display negative time values
Here's Hack #87, Display Negative Time Values, from David and Raina Hawley's Excel Hacks, 2nd Edition. Millions of users create and share Excel spreadsheets every day, but few go deeply enough to learn the techniques that will make their work much easier. Yet there are many ways to take advantage of Excel's sophisticated capabilities without spending hours on advanced study. In Excel Hacks, you'll learn how to:
- Reduce workbook and worksheet frustration--manage how users interact with worksheets, find and highlight information, and deal with debris and corruption.
- Analyze and manage data--extend and automate these features, moving beyond the limited tasks they were designed to perform.
- Hack names--learn not only how to name cells and ranges, but also how to create names that adapt to the data in your spreadsheet.
- Get the most out of PivotTables--avoid the problems that make them frustrating and learn how to extend them.
- Create customized charts--tweak and combine Excel's built-in charting capabilities.
- Hack formulas and functions--subjects range from moving formulas around to dealing with datatype issues to improving recalculation time.
- Make the most of macros--including ways to manage them and use them to extend other features.
- Use the enhanced capabilities of Microsoft Office 2007 to combine Excel with Word, Access, and Outlook.
Hack #87: Display Negative Time Values - Link
Related:
- Excel Hacks, 2nd Edition @ the Maker Store - Buy now
- Excel Hacks, Second Edition--New from O'Reilly: Hook Up with Excel Expert Hackers - Press Release
Posted by Brian Jepson |
Feb 27, 2008 12:00 PM
Excel, Excerpts, Hacks Series |
Permalink
| Comments (0)
| TrackBack
| Digg It
| Tag w/del.icio.us
February 26, 2008
Excel Hacks: Highlight alternating rows and columns

Here's Hack #21, Highlight Every Other Row or Column, from David and Raina Hawley's Excel Hacks, 2nd Edition. Millions of users create and share Excel spreadsheets every day, but few go deeply enough to learn the techniques that will make their work much easier. Yet there are many ways to take advantage of Excel's sophisticated capabilities without spending hours on advanced study. In Excel Hacks, you'll learn how to:
- Reduce workbook and worksheet frustration--manage how users interact with worksheets, find and highlight information, and deal with debris and corruption.
- Analyze and manage data--extend and automate these features, moving beyond the limited tasks they were designed to perform.
- Hack names--learn not only how to name cells and ranges, but also how to create names that adapt to the data in your spreadsheet.
- Get the most out of PivotTables--avoid the problems that make them frustrating and learn how to extend them.
- Create customized charts--tweak and combine Excel's built-in charting capabilities.
- Hack formulas and functions--subjects range from moving formulas around to dealing with datatype issues to improving recalculation time.
- Make the most of macros--including ways to manage them and use them to extend other features.
- Use the enhanced capabilities of Microsoft Office 2007 to combine Excel with Word, Access, and Outlook.
Hack #21: Highlight Every Other Row or Column - Link
Related:
- Excel Hacks, 2nd Edition @ the Maker Store - Buy now
- Excel Hacks, Second Edition--New from O'Reilly: Hook Up with Excel Expert Hackers - Press Release
Posted by Brian Jepson |
Feb 26, 2008 12:00 PM
Excel, Excerpts, Hacks Series |
Permalink
| Comments (0)
| TrackBack
| Digg It
| Tag w/del.icio.us
February 25, 2008
Excel Hacks: Reduce workbook bloat

Here's Hack #15, Reduce Workbook Bloat, from David and Raina Hawley's Excel Hacks, 2nd Edition. Millions of users create and share Excel spreadsheets every day, but few go deeply enough to learn the techniques that will make their work much easier. Yet there are many ways to take advantage of Excel's sophisticated capabilities without spending hours on advanced study. In Excel Hacks, you'll learn how to:
- Reduce workbook and worksheet frustration--manage how users interact with worksheets, find and highlight information, and deal with debris and corruption.
- Analyze and manage data--extend and automate these features, moving beyond the limited tasks they were designed to perform.
- Hack names--learn not only how to name cells and ranges, but also how to create names that adapt to the data in your spreadsheet.
- Get the most out of PivotTables--avoid the problems that make them frustrating and learn how to extend them.
- Create customized charts--tweak and combine Excel's built-in charting capabilities.
- Hack formulas and functions--subjects range from moving formulas around to dealing with datatype issues to improving recalculation time.
- Make the most of macros--including ways to manage them and use them to extend other features.
- Use the enhanced capabilities of Microsoft Office 2007 to combine Excel with Word, Access, and Outlook.
Hack #15: Reduce Workbook Bloat - Link
Related:
- Excel Hacks, 2nd Edition @ the Maker Store - Buy now
- Excel Hacks, Second Edition--New from O'Reilly: Hook Up with Excel Expert Hackers - Press Release
Posted by Brian Jepson |
Feb 25, 2008 12:00 PM
Excel, Excerpts, Hacks Series |
Permalink
| Comments (0)
| TrackBack
| Digg It
| Tag w/del.icio.us
July 31, 2007
Excel Hacks, Second Edition is out!
The second edition of Excel Hacks is out now, and it's our biggest hacks books yet, with over 130 hacks covering many versions of Excel: Excel 2004 for the Mac, as well as Excel XP, 2003, and 2007. David and Raina Hawley's new edition provides a resourceful, roll-up-your-sleeves guide that gives you nonobvious solutions to a whole pile of interesting Excel problems.
It's available now from bookstores, and you can also find it in the Make store.
Resources
Posted by Brian Jepson |
Jul 31, 2007 01:00 PM
Excel |
Permalink
| Comments (0)
| TrackBack
| Digg It
| Tag w/del.icio.us
April 3, 2007
Games Developed in Excel
Mark Danburg-Wyld sent a link to a site devoted to games developed entirely in Excel.
Are you limited in what games your company's IT/IS department will leave installed on your work machine? Well, it seems very unlikely they will take Excel away from you. And Excel, among other things, is an interesting development platform for some fairly amusing programs.So, enter Excel Games -- the site for games and play inside a program they'll never uninstall. Try them out, and you will find that the Excel version is often as good as any stand alone application!
There are really two hacks here: 1) The Excel/VB engine is completely subverted into a platform for game development and 2) since Excel is an essential business tool, identifying it as a game engine ensures that cubicle occupants everywhere can get their fix, despite the most heinous of firewall and software installation restrictions.
Excel Games - non-productive use of essential software! -Link
Posted by Jason Striegel |
Apr 3, 2007 10:44 PM
Excel |
Permalink
| Comments (0)
| TrackBack
| Digg It
| Tag w/del.icio.us
February 15, 2007
Use Microsoft Office Excel to read live RSS stock news feeds
I didn't try this out yet (and it scares me a little, it's an EXE) but if you're looking to get live RSS feeds and stock quotes -in- Excel, here's an add-on (and how-to) to do just that...
You can easily get Excel to act as a live stock RSS news reader with a free add-on. What's cool about this, as opposed to using a regular news reader, is that you can have it update the news depending on the stock symbol you are interested in. Plus, you can also add live stock quotes as well.And simply by pressing F9, your news will udpate to the latest news about your stocks!
instructables : Hacking Microsoft Office Excel to read live RSS stock news feeds - Link.
More:
Esquotes - Link.
Posted by Phillip Torrone |
Feb 15, 2007 02:01 PM
Excel, Microsoft Office |
Permalink
| Comments (0)
| TrackBack
| Digg It
| Tag w/del.icio.us
Bloggers
Welcome to the Hacks Blog!
Categories
- Ajax
- Amazon
- AppleTV
- Astronomy
- Baseball
- BlackBerry
- Blogging
- Body
- Cars
- Cryptography
- Data
- Design
- Education
- Electronics
- Energy
- Events
- Excel
- Excerpts
- Firefox
- Flash
- Flickr
- Flying Things
- Food
- Gaming
- Gmail
- Google Earth
- Google Maps
- Government
- Greasemonkey
- Hacks Series
- Hackszine Podcast
- Halo
- Hardware
- Home
- Home Theater
- iPhone
- iPod
- IRC
- iTunes
- Java
- Kindle
- Knoppix
- Language
- LEGO
- Life
- Lifehacker
- Linux
- Linux Desktop
- Linux Multimedia
- Linux Server
- Mac
- Mapping
- Math
- Microsoft Office
- Mind
- Mind Performance
- Mobile Phones
- Music
- MySpace
- MySQL
- NetFlix
- Network Security
- olpc
- OpenOffice
- Outdoor
- Parenting
- PCs
- PDAs
- Perl
- Philosophy
- Photography
- PHP
- Pleo
- Podcast
- Podcasting
- Productivity
- PSP
- Retro Computing
- Retro Gaming
- Science
- Screencasts
- Security
- Shopping
- Skype
- Smart Home
- Software Engineering
- Sports
- SQL
- Statistics
- Survival
- TiVo
- Transportation
- Travel
- Ubuntu
- Video
- Virtualization
- Visual Studio
- VoIP
- Web
- Web Site Measurement
- Windows
- Windows Server
- Wireless
- Word
- World
- Xbox
- Yahoo!
- YouTube
Archives
- September 2008
- August 2008
- July 2008
- June 2008
- May 2008
- April 2008
- March 2008
- February 2008
- January 2008
- December 2007
- November 2007
- October 2007
- September 2007
- August 2007
- July 2007
- June 2007
- May 2007
- April 2007
- March 2007
- February 2007
- January 2007
- December 2006
- November 2006
- October 2006
- September 2006
Recent Posts
- Read Excel files in Perl and PHP
- Objective-J and Cappuccino released
- HOWTO - reset a lost Ubuntu password
- Google Chrome's comic-strip technical overview
- LEGO 3D printer
- Basement Apollo Guidance Computer
- Pringles can macro photography
- YouTube Comment Snob
- iPhone macro focus
- Multitouch touch-pad support for Linux laptops
www.flickr.com
|
Most read entries (last 30 days)
- Change the message on HP printers
- LED security camera disruptor
- HOWTO - reset a lost Ubuntu password
- HOWTO: Reset a lost OS X password
- HOWTO - Read/Write to NTFS drives in OS X
- Unbrick or downgrade any PSP
- HOWTO - Install Ubuntu on the Asus Eee PC
- Make a cheap Xbox 360 Wireless Adapter with DD-WRT
- Star Wars music played by a floppy drive
- Free airport WiFi
- Using Google as a Proxy (or HOW TO: View MySpace at School)
- Play MS-DOS Games on Vista
- T-Zones and iPhone: the $5.99 data plan
- Pocket PC iPhone conversion
- Using an optical mouse for robotic position sensing
© 2008 O'Reilly Media, Inc.
All trademarks and registered trademarks appearing on makezine.com are the property of their respective owners.
Recent comments