Bookmark and Share
By: Bayshore Solutions Development Team

Like most programmers, I am always looking for a solution that will help our clients best achieve their goals as well as decrease the amount of time needed to do so. Excel is an excellent tool not only for people crunching numbers, but at times can be easily used for people hammering out iterative code as well.

Let me walk you through a basic example of how Excel can accomplish a few tasks that are sometimes the most monotonous and tedious. For this example, let’s assume that we have been given a project where we are responsible for creating an API interface that logs a couple of tasks as well as CRUD operations for user creation.

During the analysis process a reference document (usually in Microsoft Word) is created describing what information each of the API calls are supposed to receive and what information is supposed to be returned.

From this document the data is already organized for you in a grid. Let’s grab that data and paste it into an excel sheet. Now let’s create a copy of the second row, so we can modify it without feeling like we’ve ruined anything in the sheet. Highlight that row and let’s remove those spaces by hitting Ctrl + F. Go to the replace tab and type a space into Find and leave the Replace textbox empty. At this point you should have something that looks like the following:

2015-2-9-RV-Blog1

Now let’s take those arguments and turn them into something that resembles C#. For the I column on I3 we can type in =IF(H3<>””,”[Required][StringLength(” & D3 & “,ErrorMessage=””Max length ” & D3&”””)] public ” & C3 & ” ” & H3 &” {get;set;}”,””).

Then go ahead and drag that formula all the way to the end and you will get something that looks like:

2015-2-9-RV-Blog2

It doesn’t have to be pretty, the point of the spreadsheet is to complete a task quickly, not to present it to your board of directors.

At this point we are ready to paste that code into a class that has been created in Visual Studio.

2015-2-9-RV-Blog3

While this is a short example of how we can save a little bit of time. Certainly most programmers have encountered some tasks that are much bulkier and we can utilize Excel’s ability to virtually create code for us that could end up saving us hours of programming and at the same time, making writing that code a little more fun.

Bayshore Solutions has the development expertise to deliver the right web functionality for your business needs. To learn more about how we can help, contact us today.

Recomended Posts