On a rare occasion you may need to convert a column name from Excel or Google Sheets to a number. For example you may be seeing references to a random column such as D, G, BV, etc. but you don’t know how to represent it as a number. Instead of import a JavaScript library you can use plain old JavaScript. All you have to do is include this snippet in your code base and you will have access to your own toColumnNumber(…) function:

How To Use It

As you may have noticed the function is already documented. In addition, if you want direction you can check out this short video explaining how to use the function:

Examples

If you checked out the video you saw that there are two examples of how to call this function. These examples work in the YourJS console:

Final Comments

As you can see using this function is very easy. Feel free to copy the code into your codebase. As always, happy coding! 😎


Leave a Reply

Your email address will not be published. Required fields are marked *