openpyxl: Worksheet does not exist (related to character sets)
<p>I load a worksheet with openpyxl and encounter the issue <code>Worksheet does not exist</code> raised by <code>get_sheet_by_name</code>.</p>

<pre><code>#!/usr/bin/env python
# -*- coding: utf-8 -*-

from openpyxl import load_workbook

file_workbook = 'JCR2015å½±åå å­ï¼æææåä»é«å°ä½æåºï¼+ä¸­ç§é¢ååº.xlsx'
sheet_name = '2015å¹´JCR'

wb = load_workbook(file_workbook, read_only=True)
print(wb.get_sheet_names())                 # [u'2015\u5e74JCR']

ws = wb.get_sheet_by_name(sheet_name)       # raise the error: KeyError: 'Worksheet 2015\xe5\xb9\xb4JCR does not exist.'
</code></pre>

<p>What are the differences among <code>'2015å¹´JCR'</code>, <code>u'2015\u5e74JCR'</code> and <code>'2015\xe5\xb9\xb4JCR'</code>? How do I fix it?</p>

<p>It seems like you need to tell python you're using unicode:
Add this declaration at the top of your file:</p>

<pre><code># -*- coding: utf-8 -*-
</code></pre>

<p>And every string which holds Characters should be prefixed with u:</p>

<pre><code>file_workbook = u'JCR2015å½±åå å­ï¼æææåä»é«å°ä½æåºï¼+ä¸­ç§é¢ååº.xlsx'     
sheet_name = u'2015å¹´JCR'
</code></pre>

python excel character-encoding openpyxl