You could give these a try. I didn't find this functionality in POI. private int colNameToNum(final String colName) { int result = 0; String lcColName = colName.toLowerCase(); for (int ctr = 0; ctr < lcColName.length(); ++ ctr) result = (result * 26) + (lcColName.charAt(ctr) - 'a' + 1); -- result; return (result); }
private String colNumToName(int colNum) { StringBuffer sb = new StringBuffer(); int cycleNum = colNum / 26; int withinNum = colNum - (cycleNum * 26); if (cycleNum > 0) sb.append((char) ((cycleNum - 1) + 'a')); sb.append((char) (withinNum + 'a')); return (sb.toString()); } > -----Original Message----- > From: ChrisHauser [mailto:[EMAIL PROTECTED] > Sent: Tuesday, April 03, 2007 9:52 AM > To: poi-user@jakarta.apache.org > Subject: Get column index by specifying Excel column index > (i.e."C" for col C) > > > I'm working on a method where I want to pass the MS Excel > column identifier (i.e."C" or "AH) and want to retrieve the > according numerical index. I.e. 1 for "A" or 34 for "AH". > > Was looking through all the objects (i.e. HSSFSheet and > others) but coul not find this convertion. > > Any help is greatly appreciated. > > Chris > -- > View this message in context: > http://www.nabble.com/Get-column-index-by-specifying-Excel-col umn-index-%28i.e.%22C%22-for-col-C%29-tf3517898.html#a9818468 > Sent from the POI - User mailing list archive at Nabble.com. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > Mailing List: http://jakarta.apache.org/site/mail2.html#poi > The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/ > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/