dark horse
dark horse

Reputation: 447

xlsxwriter - How to call a worksheet that was created using pandas

I have created a new workbook as below:

df.to_excel(writer, sheet_name='DataSheet', header=False)

I have successfully created the worksheet, however I am trying to apply some conditional formatting to this worksheet. I am unable to call it to make any of these changes as I am not sure how to call it. Could anyone advise how could I call this worksheet.

Note: If I had created a worksheet using workbook.add_worksheet I would have been able to do it. I had to take this approach as I am calling a Pandas Dataframe and displaying the contents in this new worksheet. Thanks

Upvotes: 1

Views: 89

Answers (1)

dark horse
dark horse

Reputation: 447

Figured it out by using the following code:

worksheet = writer.sheets['DataSheet']

Now I can call worksheet and do all the conditional formatting.

Upvotes: 1

Related Questions