I have got number of queries from the list, and I am executing them and saving them on excel file. Now each result will be store on each sheet of the excel file. I am trying to run the queries in SQL Server, I was running the same code on Oracle and it was working, but its not working on SQL Server.
getting_list = self.create_list(connection_number)
query_sheet = os.path.abspath(os.getcwd()+'/Docs/query_results.xlsx')
# writer = pd.ExcelWriter(query_sheet)
for q in self.queries:
df = pd.read_sql_query(q, self.conn)
writer = pd.ExcelWriter(query_sheet, engine='xlsxwriter')
df.to_excel(writer, sheet_name=sheet_name=str(self.queries.index(q) + 1))
writer.save()
On running I am having this exception
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xc0 in position 1: invalid start byte
and this exception is appearing on following line.
df.to_excel(writer, sheet_name=sheet_name=str(self.queries.index(q) + 1))
Please Tell me where I am making mistake.