Try adding r:
in front of your code, and replace backward slash with forward slash:
Book1 = pd.read_excel(File_path=r"C:/Users/shubh/Desktop/Book1.xlsx", sheet_name="Sheet1")
There are loads of sources to read from about what r:
does to your path.
The r'..'
string modifier causes the '..' string to be interpreted literally. That means, r'My\Path\Without\Escaping'
will evaluate to 'My\Path\Without\Escaping'
- without causing the backslash to escape characters. The prior is equivalent to 'My\\Path\\Without\\Escaping'
string, but without the raw modifier.
Note: The string cannot end with an odd number of backslashes, i.e r'Bad\String\Example\'
is not a correct string.
Taken from:
Unknown python expression filename=r'/path/to/file'