Format Excel - conversion automatique
Le
Fabien LE LEZ
Bonjour,
J'aurais besoin, sur un serveur web (Debian Etch), de lire et écrire
des fichiers au format XLS (Excel 97). J'ai bien dit XLS, pas CSV.
Le tout, de façon complètement automatique.
Pour l'instant, la seule piste que je vois, c'est de lire et écrire en
XML (ou plus précisément Opendocument), et utiliser Openoffice pour
convertir.
Est-ce faisable de façon automatique ? Y a-t-il d'autres pistes à
explorer ?
Merci d'avance.
J'aurais besoin, sur un serveur web (Debian Etch), de lire et écrire
des fichiers au format XLS (Excel 97). J'ai bien dit XLS, pas CSV.
Le tout, de façon complètement automatique.
Pour l'instant, la seule piste que je vois, c'est de lire et écrire en
XML (ou plus précisément Opendocument), et utiliser Openoffice pour
convertir.
Est-ce faisable de façon automatique ? Y a-t-il d'autres pistes à
explorer ?
Merci d'avance.

Poser une question


Il existe le module python "Python XLS Reader":
Le readme.txt donne des liens vers des solutions en Perl, PHP et Java,
je le colle pour info:
pyXLReader
================= pyXLReader is a Python library for reading Excel compatible
spreadsheets.
It's a port of JAVA jexcelapi and PHP Spreadsheet-Excel-Reader to
Python.
It allows reading of Excel compatible spreadsheets without the Windows.
Requires Python 2.2+
Authors, copyright, and license
==============================
pyXLReader was ported by Ilia Harlamov from
jexcelapi and Spreadsheet-Excel-Reader (URL see below)
Copyright (c) 2005 Ilia Harlamov Copyright (c) 2004 Vadim Tkachenko (Spreadsheet-Excel-Reader)
Copyright (c) ???? Andy Khan (jexcelapi)
Distribution's license is GNU LGPL. The included LICENSE.txt file
describes
this in detail.
Useful links
===========
Perl Spreadsheet::ParseExcel
http://search.cpan.org/search?dist=...ParseExcel
OpenOffice's Spreadsheet Project
http://sc.openoffice.org/
http://sc.openoffice.org/excelfileformat.pdf
POIFS (OLE2) format documentation
http://jakarta.apache.org/poi/poifs...ormat.html
http://jakarta.apache.org/poi/poifs/fileformat.pdf
PHP Pear Spreadsheet-Excel-Reader (Vadim Tkachenko)
http://pear.php.net/package/Spreads...el_Reader/
Java API for reading, writing and modifying the contents of Excel
spreadsheets
http://www.andykhan.com/jexcelapi/index.html
PHP Spreadsheet Excel Reader
http://sourceforge.net/projects/phpexcelreader/
--
Ilia Harlamov
--
Pierre Maurette
Oui et ce directement à partir du format natif MS Office avec unoconv et
en utilisant openoffice en headless sous forme de service.
Je n'ai pas sous la main la configuration exacte que j'ai mise en place au
boulot, mais si tu souhaites, je te la donnerai.
--
Stéphan Peccini
Les photos : Les Pyrénées : Le blog :
Je veux bien. Merci.
Merci.
Je suis en train de regarder tout ça. Pour lire le contenu d'un
fichier Excel, ça a l'air prometteur. Pour créer un fichier, je suis
plus dubitatif.
Tu a besoin de Xvfb, openoffice avec pyuno et headless et unoconv :
http://dag.wieers.com/home-made/unoconv/
Le fichier unoconvd pour lancer le service :
#!/bin/sh
#
# openofficeorg This shell script takes care of starting and stopping
# openoffice server.
#
# chkconfig: 2345 99 35
# description: unoconv listener for converting documents with OOo
. /etc/rc.d/init.d/functions
# See how we were called.
case "$1" in
start)
printf "Starting unoconvd: "
/usr/bin/Xvfb :8101 -ac &
sleep 5
su - apache -c "export DISPLAY=:8101.0;/usr/bin/unoconv --listener
&"
echo
;;
stop)
printf "Shutting down unoconvd: "
killall soffice.bin
echo
;;
restart)
$0 stop
$0 start
;;
*)
printf "Usage: unoconvd {start|stop|restart}n"
exit 1
;;
esac
exit 0
###################
Et pour convertir un fichier Excel en CSV tu lances la commande :
/usr/bin/unoconv -d spreadsheet -f csv fichier.xls
Je te laisse voir toutes les possibilités :
http://linux.die.net/man/1/unoconv