Converting XML Data web file to XLS file in python on linux - python

I'm beginner in python programming and i'm currently struglling to find a solution with my python script. Here is my issue,
I wrote a small script in python using python-excel modules ( xlwt,xlrd and xlutils). This script is using an xls file that i converted from a xml data web file manualy by opening it and save it as a xls when i have done the local test.
But as i'm installing my script on a linux server side, i need to make this conversion automatically by using a python script but a i can't figure out how to do it ?
I looked over xlutils but i didn't find a way to make it.
By the way the purpose of this script is to compare 2 xls files and create a new update xls file.
Is it possible to do it with python ? or maybe directly on linux command tool?
Thanks
N.B: sorry for my poor english.

Related

Python script works in Spyder but doesn't when converted to an exe

I've written a simple python script that uses openpyxl to read IP's out of an excel file and does a whois lookup on it and writes the results to a new excel file. Everything works great in Spyder but when I package it as an exe using pyinstaller I get an error when I run the exe.
The traceback says "'Worksheet' object has no attribute 'values'" like it's not reading the values from the original excel file. I've tried using the full path of the file but still get the same error. The excel file is in the same directory as the exe. Do I need to package the exe in a different way? Specifically tell it to package the openpyxl library?
I've done a lot of googling and can't find much info. Any help is appreciated! Thank you

Program that can compile a python file from an alredy compiled python file

I'm searching a way to compile a python file into an exe from an alredy compiled python file.
For example:
I have main_script.py, I used PyInstaller to convert it into main_script.exe
Into main_script.exe there is a part of code that convert some hardcoded lines of python into a new exe (or maybe even creating a python file, converting it and then deleting the python file).
Now when I start main_script.exe I need to have new_exe.exe and another_exe.exe in my cwd (Current Working Directory).
I searched a lot but I didn't found anything useful, can someone help me? Thanks

Automating excel tasks in Python | Monitoring a folder and triggering a python script in MAC OS

I am trying to automate excel tasks in Python using Pandas.
I get 3 input data files which I intend to store in a folder and run python script which will read the python script do the data transformation and write an output excel file.
My question is how do I Monitor the folder and run the python script if there is a file there. For example if the excel input files are copy pasted in a defined empty folder1 it should trigger the python script automatically and generate the output file in a defined empty folder2.
I have already made a python script which does the data manipulation by reading the input files and generating the output excel file. How do I go about the automation which triggers the python script?
PS: I work on mac laptop any reference compatible with iOS would be greatly appreciated.

Send ctrl+q to excel file using python

I have an excel file that I need to press ctrl+q to make a vba code(macro) to run.
is there a way to do this with python?
someting like:
with open (my_file,"wb")
"press ctrl+q"
close file
Thanks!
the open command is for opening a file and manipulating it's raw content - not suitable for your need
the are are modules for reading and writing excel files like openpyxl, but they don't include running vba macros. if the macro functionality can be implemented in python, this will probably be a good start.
If you need to run macros, you need to interact with an instance of excel using com automation (so you need to have it locally installed) - the pywinauto module can be a good start
I built a macro that starts when I open the file and add it to a template.
I created my new files with the template (using panda) and when I open them- the macro runs alone,
Thanks All!

How to share AutoKey and TextExpander snippet files : json vs. xml

I'm using AutoKey on Ubuntu (12.04) and it works fine. Now I want to use a shared DropBox file, containing all snippets, however this is a TextExpander file because my colleges use MACs and have another app like AutoKey, called TextExpander.
Their .textexpander file seem to be XML, while my AutoKey uses JSON files.
Can I use a shared .textexpander XML-file with my AutoKey program?
Is it possible to redirect / convert the .textexpander snippets file (on DropBox) to an autokey.json file, eg. with a Python script and if then how?
Note: I'm not a linux novice, so I can create / adjust some python scripts and access the file system.

Categories