Excel Services whitespace problems with parameterized queries when loading excel sheets

If you are having problems with spaces when accessing excel sheets with spaces in their names what you need to do is to add two single quotes on both left and right of the sheet name.

Sample query to get a HTML formatted sheet data with start and end cell definitions:
http://webapplicationname/_vti_bin/ExcelRest.aspx/Documents/file.xlsx/model/Ranges(”’sheet name with spaces goes here”!A1%7CF63′)?$format=html
The query above has a spaces in the sheet name. In the sample above the sheet name is “sheet name with spaces goes here“.

NOTICE: Add two single quote ‘ not one double quote “.

If you where to use a formatted string to fill in the missing data it would look something like this:

String excelWebServicesURL = “{0}/_vti_bin/ExcelRest.aspx/{1}/model/Ranges(”'{2}”!{3}|{4}’)?$format=html”;

0 = your site absolute URL. This means the present site location inside your site collection.

1 = the relative URL to the excel file

2 = the sheet name

3 = The cell where to start the reading of data from

4 = The cell where to end the reading of data to