PowerShell Script working with Excel COM Object buffering on different Clients - excel

I created a fairly big PowerShell Script working with the Exce COM Object to Output Data it read into some .ini files.
I converted the Script to .exe with the Win-PS2EXE Programm.
When I start the Script on my Fujitsu PC it creates and then populates the Files.
When my Collegue uses it on his Lenovo, the files get created (So it can't be a filepath problem) but there isn't any data that gets written into them.
My Fujitsu
Windows Version 10.0.017134 Build 17134 (Everything is the Same)
PowerShell Version 5.1.17134.858 (Everything is the Same)
All Excels fully closed
No Clicking around when it's taking a while
Script version 3.8
Microsoft 360 Account with newest Excel
Same Excel File Used
His Lenovo
Windows Version 10.0.017134 Build 17134 (Everything is the Same)
PowerShell Version 5.1.17134.858 (Everything is the Same)
All Excels fully closed
No Clicking around when it's taking a while
Script version 3.8
Microsoft 360 Account with newest Excel
Same Excel File Used
The Script itself works. It was tested and debugged over multiple Months and it always worked (on multiple, different systems) with no Errors.
Where could the problem be or what could I try to do?

So, I don't know why or how, but the Excel itself is broken after I transfer it to his PC. (All Permissions etc. are set so that the excel works and everything.)
I copied the Data in the Excel into a new Excel File, which I transferred the same way again (Network Folders). This time it worked.
All in all, the Excel File itself has some Corruption. I may look into it and if I find a Solution I'm going to post it here.
For now I know the Script has no Error and works on all other Systems, but if anyone knows what could've caused the problem, I'd be grateful to know!

Related

How to print 2 excel tabs to PDF using python on Linux (not Windows)

I am working on Linux (Strictly Centos Type Linux) and using python3
I have some Microsoft Excel (xlsx) files that I am pulling from an FTP server, and I need to generate a PDF from 2 tabs having print formatted areas.
(I am using the word Print, because I cannot copy data to dataframe and create PDF from it. That will not suffice, as these are reports that have formatting. Hence they need to be printed to PDF)
I am unable to create a PDF out of it, on Linux.
AFAIK, win32com will not work on Linux. Also, I need the script to be automated without manual intervention.
Any help or suggested articles are welcome!
Thanks,
K3
This is not possible on a Linux distro as a copy of Excel must be fully installed and accessible. Otherwise, you can use the Win32 api (Need to have Windows).
https://pypi.org/project/pywin32/

Issue Windows / Excel - Seeing a hidden opended excel file in Python although all instances closed

I have this issue where an Excel file appears to be opened when I use Python although there is no Excel instance running. It is impossible to see it via Windows, even with the hidden files option selected ; only using Python in this case (the last item in the list on the last line of code) :
Moreover, it persits even when I tried the following :
Deleting the file,
Copy/paste the whole folder somewhere else,
Renaming the file,
Rebooting...
This is a nightmare... I can't figure why windows would keep a hidden file openened somewhere.
#Boris
Is there someone who has opened/editing this file on a remote/remote desktop connection?

Setting up an automated pdf comparison on a server

Documentation is generated for every new build. I want to automate the process of comparing the new pdf with the old one and outputting the differences onto a text or image file. I also have the option of comparing large HTML folders or chm files(which is complicated as they are compiled files). How should I go about doing this? (I am looking for freeware Python tools)
I have looked into pdf-diff, a Python tool that does exactly what I want. But since I am working on a windows machine with no visual studio, when I try to install it using pip, I get the error "Unable to find vcvarsall.bat".

Excel can't establish with xlwings connection when running from standalone Python app from Excel

I am trying to create standalone app from a script with xlwings. I used both py2exe and cx_freeze. Both work just fine outside Excel (I added some tests). When I import either of them as a VBA macros in Excel, they also work fine. But so far, on my computer only. I asked my friend to check if the script works on her computer and she got the following error:
So I thought it make sense to figure out whether I do something wrong. I sent her a Fibonacci example and it raised sort of the same error:
It should be something wrong with names of the files, but it's not like obvious for me what exactly. Maybe somebody already knows how to deal with it? Thanks!
If files are downloaded from the internet, they only work right away in the first instance of Excel. Meaning: Your friend should try to close Excel completely. Also check in the Task Manager if there is still an EXCEL process running and if so, kill it. Then try again in a fresh instance of Excel.
update:
Ah I see - the problem seems to be a bug happening when there are unicode characters involved in the file path! I've opened a issue here. In the meantime, try to run the file on a path without unicode characters.

How to create excel file by copying CSV files and running VBA macros remotely from Linux

I'm running some task on Linux which produces certain CSVs. Once they’re produced, I need to copy them into different sheets of an excel file and then run some VBA macros to generate a report. Since this has to be done multiple times a day (with no pre-defined/fixed schedule), I’d like to automate it.
Here is what I tried:
I wrote a VBScript, which takes the CSV files and other required input files, opens an excel file, copies the CSVs into the excel, runs some VBA macros, and saves and closes the result. This VBScript works fine when triggered locally on a windows server.
I have uploaded a simpler version of the files involved here which somewhat clarify my requirements (Note that the macros I need to run are much more complicated (~500 lines) compared with the macros here).
There are four files inside the archive:
Template.xlsm: The Excel template of the report into which data is to be pasted
Input_Sheet2.csv : The input data to be pasted into the template into sheet 2
Input_Sheet3.csv : The input data to be pasted into the template into sheet 3
Run.vbs: The vbscript which triggers the “copy-paste” macro present inside the Excel template.
The command to run the VBScript is: ‘cscript //Nologo Run.vbs /NoCancel’
Now, in order to automate whole task, I thought to trigger this VBScript remotely from Linux over ssh. I installed the cygwin ssh daemon on the windows box and facilitated ssh connections from the Linux machine. This cygwin ssh connection from Linux allows to run several windows commands, but fails to run the VBScript and doesn't produce any excel output.
I can't figure out which component has limitations. Is it cygwin ssh not facilitating execution of VBScript? Is it VBScript not facilitating creation of files remotely? Is it ssh client on Linux not allowing opening of excel in GUI format? Or there is another way to automate this task from Linux.
Thanks,
Shubham
I'd focus on:
Did you test running your script from the Cygwin Terminal? (I did try a simple script, that opened Execl (.Visible = True) successfully, so I believe your fears concerning cygwin not allowing to open the Excel GUI are unnecessary).
Do the sshd user account's path and cwd allow the short invocation "cscript Run.vbs" or should the long version "/cygdrive/c/WINDOWS/system32/cscript.exe /home/user/Run.vbs" be used?
Does the sshd user have access/permissions to all involved files and folders?
You didn't forget the unix file systems are case sensitive? (I did and wasted some time)?

Resources