alex chan
alex chan

Reputation: 1

raise IllegalCharacterError(f"{value} cannot be used in worksheets.")

I was trying to get data from oracle sql developer using python cx_oracle package and storing the data in an excel. While storing the data in excel i am getting the error below

raise IllegalCharacterError(f"{value} cannot be used in worksheets.") openpyxl.utils.exceptions.IllegalCharacterError: ALTER SESSION SET CONTAINER=EWP0342_SAD_OAS_RHI cannot be used in worksheets.

connection = cx_Oracle.connect(f"strings")
cursor = connection.cursor()
print('Oracle Connected Successfully for RHI')
query2 = f"Select * from unified_audit_trail where EVENT_TIMESTAMP >= TO_DATE('{from_date}','dd-mm-yyyy')"
# Fetch the results
data2 = pd.read_sql(query2,connection)
data2.to_excel(os.getcwd()+'/reports/RHI_ewp22.xlsx', index=False, engine="openpyxl")   ## error line that i am getting
print("Generated report at ", self.now)
cursor.close()
connection.close()

I tried to get the data and store in an excel from oracle db. Also, the length of data will be 150k+ entries. it is taking more than 30 min for extracting. Need to reduce time and extract the data without any error.

Upvotes: 0

Views: 553

Answers (0)

Related Questions