import .xml file as calc sheet

I want to replace ms excel with libreoffice calc for one of my clients but calc does not display the XML file in the same way as excel do.
I wrote a python script that reads the XML file from standard input and sends a csv file to standard output .
I want to create an XML file filter to create a spreadsheet to insert inside calc.

I am very interested in programming in python that you can find at:
but to export an XML file to a csv one.

Can you give me some direction to use the python scripts inside libreoffice as the example above?

I create a simple example for you, see:

Best regards

Hi Mauritio,

I can adapt my code using your example with no problems to create the spreadsheet but I need one more step .
I wish that when the user opens with libreoffice calc an xml file launches my python script to get the spreadsheet back.
How I can teach libreoffice calc to load the spreadsheet using my script ?

This solution is close to what makes ms excel that does its best to show the xml file as a spreadsheet.

My code is generic enough to handle many xml files without problems , then I would teach libreoffice to open xml files using calc and do not write how it happens.
Where can I find the documentation that explains how to do it ?

Thank you very much.

[Added after response to add details]
the use case that I would handle is the following:

  1. Mary wants to open an XML file with libreoffice but She want to see it as a spreadsheet in cal.
  2. She selects the xml file and using the right mouse button and she choose the option " open with libreoffice calc "
  3. calc forwards the xml file to my python script that loads the spreadsheet
  4. once the spreadsheet is populated with the values ​​coming from the xml file She can save it in csv or xls or ods file.

I hope I explained it better.

The better documentation that I know, this here: Python - Apache OpenOffice Wiki
only spanish

I’m sorry, I’m not understand your question. You ask… how ask to user the file xml?

Try with: