Preview:
def excel_maker(dataframe,file_name,path=os.getcwd(),sheetName="Sheet"):
    file_name = os.path.join(path, f'{file_name}.xlsx')
    if not os.path.exists(file_name):
        writer = pd.ExcelWriter(file_name, engine='openpyxl')
        dataframe.to_excel(writer, sheet_name=sheetName,index = False)
        writer.save()
        writer.close()
    else:
        writer = pd.ExcelWriter(file_name, mode='a', engine='openpyxl')
        dataframe.to_excel(writer, sheet_name=sheetName,index = False)
        writer.save()
        writer.close()
        

data = pd.DataFrame(reference_id)
excel_maker(data,file_name=f'new_{billboard_type}',path=output_file_path,sheetName=collection)
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter