[Tutor] WRITING XLS FROM OS.WALK()

Susana Iraiis Delgado Rodriguez susana.delgado_s at utzmg.edu.mx
Mon Oct 11 19:11:51 CEST 2010


Hello Walter and members:

I'm working with csv to handle excel, my other was useful to do my new cvs
file. When I open the output file, it has all the information I need, but
all of my lines have the filepath separate by comes, even though it's
supposed to be a complete string; for example: C,:,\,i,n,d,i,c,e,.,s,h,p all
the others have the same format.
Besides I need a row to put in each cell the column names, with:
 c.writerow(["Archivo","x_min","x_max","y_min","y_max","geometria","num_ele","prj","estructura
bd","extent","fecha_modificacion","maquina_host"]). But all tha names gather
in the same row and I want my pathfile to place under the "Archivo" column,
but I couldn't do it.



2010/10/11 Walter Prins <wprins at gmail.com>

>
>
> On 11 October 2010 14:37, Susana Iraiis Delgado Rodriguez <
> susana.delgado_s at utzmg.edu.mx> wrote:
>
>> The other question is about the excel files management, if I want to
>> manipulate this data to work it in Excel should I look for an excel library
>> in python right?
>>
>>
> Yes. I already mentioned one (in my view good) option in my original reply
> to you.   The xlwt module works quite well for generating Excel files (with
> expectable limitations) from any platform that Python's available on (e.g.
> including non-Windows.)  and thus does not require Excel to be available on
> the machine you're producing the file on.
>
> If however you are running on Windows and have Excel installed, you could
> consider driving the real Excel via COM automation, which will guarantee you
> get desired results including formatting, charts etc, and will ensure you
> have full access to all the functionality Excel exposes via its COM object
> model.
>
> If your requirements on the other hand simple enough then Joel's suggestion
> to use CSV is probably preferable.  (The KISS principle: "Keep It Small &
> Simple")
>
> There's also the possibility to look into generating .xlsx files (e.g. XML
> based Office format files.)  Theoretically you should be able to generate
> the correctly structured XML independent of Excel and have it open in
> Excel.  I suspect that may be rather painful though (have never tried this
> myself) andam almost reluctant to even mention this option, so caveat
> emptor.
>
> Walter
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20101011/138884db/attachment.html>


More information about the Tutor mailing list