Export Magento Attribute Options to CSV with the Table Capture Chrome Extension

Published: June 20, 2018


Recently, I received the following request from a client…

How can I get an export of all the options for a given attribute in Magento?

There are several attributes I need to do this for…

Looking at the Magento admin panel, it quickly became evident that there was no self-serve way for the client to export the data.

The attribute option edit screen in Magento 1

Here I’ll document my approach, which ultimately led me to the Table Capture Chrome extension.

Can I Just Copy / Paste It?

The first thing I tried was to simply copy / paste the data from the web page into Excel.

As you can see below, that didn’t work out too well…

The result of pasting the data to Excel

Use A Script?

I did some quick Googling and found a script published by Peter Jaap that would generate an export of all attributes and attribute options in a given Magento system. While this was nice, this script would set me down one of the following paths…

  1. Run it as a one-off and provide the output to the client. This would mean if they needed the data again at some point in the future they would need to contact me and I’d then run the script for them again.
  2. Wrap the script in some sort of controller layer that could be used on demand by the client. This would require coding / code review, QA, UAT and deployment.

Neither of these solutions seemed ideal.

Scraping The HTML?

The idea suddenly popped in my head - this data is just in an HTML table, I wonder if there’s some way to just scrape if from the browser and get it into CSV format. My initial thought was to try to write some JavaScript that the client could run in the console, but this wasn’t a particularly technically savvy client, and I wasn’t sure how well that would go over.

Then, I had another idea - I wonder if there’s a browser extension that could be installed to do exactly this?

Looking For A Browser Extension

Another quick round Googling later I found the “Table Capture” Chrome extension. I did some quick testing and found that it could do exactly what the client was asking. It works something like this…

  • While viewing any page click the Table Capture icon in the browser
  • A menu flies out listing each <table> element on the page.
  • Next to each listing there are two icons, one to copy as CSV to the clipboard and the other to open in Google sheets.
  • Use these features as needed to grab the desired data.

A screenshot demonstrating the Table Capture functionality

I sent the client these instructions along with some screenshots demonstrating how to use the tool. I heard back shortly thereafter from the client this solution worked perfectly for their needs.

Request resolved, no coding required. Mission accomplished :raised_hands:

Max Chadwick Hi, I'm Max!

I'm a software developer who mainly works in PHP, but loves dabbling in other languages like Go and Ruby. Technical topics that interest me are monitoring, security and performance. I'm also a stickler for good documentation and clear technical writing.

During the day I lead a team of developers and solve challenging technical problems at Something Digital where I mainly work with the Magento platform. I've also spoken at a number of events.

In my spare time I blog about tech, work on open source and participate in bug bounty programs.

If you'd like to get in contact, you can find me on Twitter and LinkedIn.