All Questions
170 questions
2
votes
0
answers
101
views
PyWin32 throws "pywintypes com_error call was rejected" error, but only when NOT running from CMD
System setups:
Development PC: Win 10,Python 3.7.7, PyInstaller 5.3.12
Deployment PC: Win11, No Python installled
I've made a CLI python script (running from Windows CMD) with the following simple ...
2
votes
1
answer
62
views
Unable to set any property when protecting an excel worksheet using pywin32
I am using pywin32 for a project to automate a few excel files using python.
In the excel file, I want to protect all the cells that contain a formula.
So, I first unlock all the cells and then only ...
2
votes
1
answer
50
views
How to Close All Excel Files in a Specific Directory Using Python?
I'm working on automating some tasks using Python, and one of the requirements is to close all Excel files that are currently open in a specific directory. I often have multiple Excel files open from ...
0
votes
1
answer
359
views
Creating/Updating an excel file with slicers from python
I have some python code which creates a few pandas data frames which I need to put into a spreadsheet, with different data on multiple sheets and with slicers for easy filtering. This then gets sent ...
0
votes
1
answer
60
views
Excel Ungrouping data
I am trying to ungroup the data in excel file.
I am not aware of row no which have been grouped.
When I click on 2 on top of file data gets ungrouped.
Is there a way I could do it using python.
I ...
0
votes
0
answers
59
views
Calling Excel Macros in Python
I need help with my python code for the following:
In this network path: “\folder\name\endfile.xlsm”, I have a file called "endfilexlsm" Within this file, I have a macro called “...
0
votes
0
answers
122
views
CopyPicture method of Range class failed - Python
I am running into the following error in Python pywintypes.com_error: (-2147352567, 'Exception occurred.', (0, 'Microsoft Excel', 'CopyPicture method of Range class failed', 'xlmain11.chm', 0, -...
0
votes
1
answer
153
views
openpyxl vs pywin32 vs others libraries: copy and paste the value of cells containing the =IMAGE() in Excel
I'm trying to copy and paste the values of cells containing the formula =IMAGE(Url) in Excel. The result is an image embedded in the cell and no longer linked to the Url.
I am able to do it with ...
0
votes
0
answers
358
views
Win32Com Opening Excel in Background, Not Visible, Can't Run Macros
The following code in Python is not opening excel visibly on my device, and excel launches as a background process instead of an app.
import win32com.client
excel = win32com.client.Dispatch("...
0
votes
0
answers
32
views
How to configure a maximum of 3 pages of an excel file to be printed in python?
I am working with openpyxl and win32.
I have a code that after set some settings, like landscape orientation, print area, etc I print the file, It works very well the only problem I am facing is that ...
0
votes
0
answers
95
views
How to use python to control hotkey in excel (pyautogui)
import win32com.client as win32
import pyautogui
file_path = r'my path'
excel = win32.gencache.EnsureDispatch('Excel.Application')
excel.Visible = True
wb = excel.Workbooks.Open(file_path)
sheet = ...
0
votes
1
answer
40
views
How to concat 2 strings in pywin32 (excel) in a range?
I use win32 in python to automaticly adjust import files. I'm trying to take 2 cellvalues and concat them into a third value, which gets written into the other worksheet.
I get the error message that &...
1
vote
0
answers
66
views
Is there a way for python to read in datasets in excel generated by an excel function?
I paste a formula into excel that will generate a dataset in excel. The dataset is successfully generated in excel, but I attempt to read in the excel into python with pd.read_excel, I always got an ...
1
vote
1
answer
471
views
pywin32 - get cell Address in R1C1 format
I am working with pywin32 and trying to get the R1C1 address of a specific cell. In VBA, you can use Range.Address(ReferenceStyle:=xlR1C1).
However, it appears that in pywin32, using Range.Address is ...
0
votes
1
answer
167
views
How can I filter the Excel column by dates?
The bottom line is that the column contains data in the form of m/dd/yyyy and the data type is Date, as a result of which Excel screws up the filtering * first select the year, for example, 2023, and ...