Category : excel

I have a few dataframes that I am trying to transfer to excel. Using this method, I successfully did so… writer = ExcelWriter(f’DRAGON{date}.xlsx’) stats.to_excel(writer, f’ELO{date}’) pdf.to_excel(writer, f’Playoffs{date}’) sec.to_excel(writer, f’Second Round{date}’) cf.to_excel(writer, f’Conference Finals{date}’) cham.to_excel(writer, f’Finals{date}’) df.to_excel(writer, f’Stanley Cup Winner{date}’) writer.save() writer.close() This worked for a while, but for some reason it stopped working the other ..

Read more

I would like to convert the following csv file to a txt file. import csv csv_file = (r’symbols/Input_weekly_insidebar.csv’) txt_file = (r’symbols/Input_weekly_insidebar.txt’) with open(txt_file, "w") as my_output_file: with open(csv_file, "r") as my_input_file: [ my_output_file.write(‘,’.join(row)) for row in csv.reader(my_input_file)] my_output_file.close() In the txt output file each symbol should have a comma ‘,’ after the symbol. Result should ..

Read more

I can add hyperlink for one value in xls cell using: from openpyxl import load_workbook wb = load_workbook(‘sample.xlsx’) ws = wb.active ws[‘A1’] = "item1" ws[‘A1’].hyperlink = ‘https://my.server/link-to-item1’ ws[‘A1’].style = ‘Hyperlink’ I wonder if it’s possible to create a list of items in the same cell when every item is a different hyperlink? Source: Python..

Read more

I have an excel pivot table And I want to clear the date filter using python library win32com.client I tried this code: fileDirectory = file.xlsx excelFile = win32.gencache.EnsureDispatch(‘Excel.Application’) excelFile.Visible = True excelFile.DisplayAlerts = True wb = excelFile.Workbooks.Open(fileDirectory) ws = wb.Sheets(‘sheet’) ws.PivotTables(1).PivotFields("date").ClearAllFilters() wb.Close(False) wb = None excelFile.Quit() excelFile = None but this didn’t work for me ..

Read more