I'm using code to copy a df to an excel spreadsheet starting in cell A2.
Here's the code snippet. I'm including all the imports used in the code.
import pandas as pd
import numpy as np
import os
import pathlib
from pathlib import Path
import win32com.client as win32
import datetime as dt
from datetime import timedelta
import openpyxl as xl
import xlwings as xw
NewPortfolio = Path.home().joinpath("Desktop", "test.xlsx")
wb1 = Path.home().joinpath("Desktop", "test2.xlsx")
NewPortfolio_pd = pd.read_excel(NewPortfolio)
app = xw.App(visible=False)
wb = xw.Book(wb1)
ws = wb.sheets['Sheet1']
ws.range('A2').options(index=False).value = NewPortfolio_pd
wb.save()
wb.close()
app.quit()
Here's the error
AttributeError: module 'win32com.gen_py.00020813-0000-0000-C000-000000000046x0x1x9' has no attribute 'CLSIDToPackageMap'
I've already tried uninstalling and reinstalling pywin32, and have not been able to find a solution online at the moment.
If you have any comments or recommendations it'd be greatly appreciated
Thanks in advance!