'Pandas ExcelWriter is exporting properly when instantiated in a notebook but its not exporting properly when being imported from another script

I have a function that generates a pandas ExcelWriter.

Example:

def fake_excel_wrapper(data):

    writer = pd.ExcelWriter('test.xlsx')

    workbook = writer.book

    # Establish the sheet name
    data.sort_values('rank',ascending = True).to_excel(writer, 
    sheet_name='side_by_side_comparison', header=True, index=False)

    writer.save()

When I instantiate this function within my notebook, it runs generates an excel spreadsheet as expected. Now, when I import it via some utility script, it doesn't output any results. I've made sure ExcelWriter is installed.

I apologize for the vague details. I'm having a hard time understanding why there is a difference.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source