i am scratching data from web and trying to write new data to excel.The script does it succesfully. But what I observed nor pandas and not openpyxl has an attribute to preserve already excel sheet colors. That's why after researching web i chose to work with win32 package.
Code at the ends opens up many excel objects but does not open file. Error is pywintypes.com_error: (-2147352567, 'Exception occurred.', (0, None, None, None, 0, -2147352565), None)
code is below;
import pandas as pd
import openpyxl
import win32com.client
app=win32com.client.gencache.EnsureDispatch('Excel.Application')
app.Interactive=True
app.Visible=True
wb=app.Workbooks('./outputFile/output.xlsx')
ws=wb.Worksheets('URLS P1')
ws.Range('A1:G1').Interior.Color=RGB(155,192,0)
from python win32client package trying to manipulate excel column color
No comments:
Post a Comment