0

I have to extract data from the excel files which contains large decimal values. I have tried reading it through xlrd and pandas both but the same error in both cases.

from xlrd import *
import decimal
workbook =open_workbook('C:\Users\KRISHNA\Desktop\ERIAN\Data\TARGET-AREA.xlsx')

Error

(unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape

At this beginning stage only I am getting the error.

ayrusme
  • 506
  • 5
  • 17

1 Answers1

1

The problem is in the string prefix "C:\Users". \U is interpreted as a unicode sequence beginning. Prefix your string with "r" to indicate that it is a raw string:

from xlrd import * 
import decimal 
workbook = open_workbook(r'C:\Users\KRISHNA\Desktop\ERIAN\Data\TARGET-AREA.xlsx')
havanagrawal
  • 1,039
  • 6
  • 12