Match and index is a super useful tool that has personally saved me hours of manual copy and pasting of information.
Instead there is a better way. All you need is two sets of data, and a point where they match.
In my experience, I’ve used this to match two price lists based on SKU and easily copy over UPC codes, weight, our cost and other useful information you may want to upload to your wordpress database or whatever.
Here is a brief example of how to do this- it works on Microsoft Excel and LibreOffice Calc.
Essentially, we are going to use the MATCH and INDEX functions common on most spreadsheet programs to copy over some data (like price) based on a match in the same row (like SKU).
INDEX(the column you want to copy, MATCH(the cell you want to match, the column of data you are matching against))
Keep in mind
Match sure all data is formatted the same way; strings will not match numbers.
Before we get started, lets actually make sure that our plugin is setup properly.
First we are going to add some code to the plugin which simply outputs ‘Hello’. Next we will move the folder to the wp-content/plugins directory. Finally, we will activate our plugin and check for the ‘Hello’ on our webpage.
First add the following code to the bottom of your .php file.
add_action( 'wp_head', 'gerrg_say_hello' );
If you are not familiar with the WordPress Plugin API, in the code above we are simply adding an action to a hook. A action is simply a function, a hook is a SPOT in the code where that function will run.
Above we are adding our gerrg_say_hello function to the wp_head hook. The wp_head hook is triggered between the <head></head> section of the website.
Simply put, we expect to see ‘hello’ at the top of our webpage.
Activating your plugin
It’s very likely you already know how to activate a plugin. First we need to move our folder into the wp-content/plugins directory of our web server.
There is more than one way to do this and I leave it to you get accomplish this task.