If you’re like me, when you have a lot to do and not a whole lot of time to do it, saving time on repetitive tasks certainly helps—creating scripts with Excel can do just that.
Aside from writing some old batch files, I don’t really know how to script things that well. Sure, I can take someone else’s script and modify it fairly easy—but making one from scratch is not what I do best.
So what I like to do is use Excel to create some scripts for me. I’ll go through an example of how to use Excel to quickly create some scripts.
Using Microsoft Excel to Create Scripts
Below is the command for a VNX to create a new LUN in a pool. Columns A, C, E, G, I, K don’t change (neither does B in this example, but it does change per VNX system you’re working on), but the rest do, so you can just copy and paste those down the columns. After that, you can put in the data that you want.
The important thing is that in Excel, if you start the cell with a dash, or minus sign, it will change what is in the cell. I use spaces on all the columns that don’t change, and make sure there are no spaces in the columns that do change.
After you get all your information into Excel, highlight it all except the first row with the column information. Then, copy and paste it into Notepad.
When you do this, it copies over a tab from Excel that separates each cell—as you can see below, the spacing is way off.
The highlighted area is one character (a tab): highlight it, copy it, and then replace it with nothing.
After you replace all, you will get the format you need and you can just copy and paste that into whatever CLI you need to use. I would suggest you copy and paste the first line only, in order to ensure you have no errors in your syntax.
This example was specifically for an EMC VNX, but you can use this method for anything you need to do repetitive tasks for and only a portion of the information changes.