5 Replies - 768 Views - Last Post: 08 August 2012 - 12:55 PM Rate Topic: -----

#1 chanshe112  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 08-August 12

read and write from text to excel file

Posted 08 August 2012 - 07:33 AM

Hello I downloaded the xwlt module, but how to write and read from a text to excel for example
3101 Ms. Leanne Jones 278 High Street Blackwood Gwent NP12 2BN United Kingdom 1495225229. this is the data what I have in notepad.
I want to put this data in excel like this.

Sr. No. Title First name Middle Name Last Name Company Job Title Address City State/Province Zip/Postal Code Country Region primary Phone Mobile Phone Email address


Can anyone help me.

Is This A Good Question/Topic? 0
  • +

Replies To: read and write from text to excel file

#2 atraub  Icon User is offline

  • Pythoneer
  • member icon

Reputation: 756
  • View blog
  • Posts: 1,990
  • Joined: 23-December 08

Re: read and write from text to excel file

Posted 08 August 2012 - 08:19 AM

Can you show us the code you have so far and a detailed error explaining why it doesn't work.

This post has been edited by atraub: 08 August 2012 - 08:20 AM

Was This Post Helpful? 0
  • +
  • -

#3 chanshe112  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 08-August 12

Re: read and write from text to excel file

Posted 08 August 2012 - 08:26 AM

So far, I have not started it.
What I did was I used file object and read the file but I don't know how to proceed from there.

Regards,
Shekar
Was This Post Helpful? 0
  • +
  • -

#4 FamiHug  Icon User is offline

  • New D.I.C Head

Reputation: 8
  • View blog
  • Posts: 34
  • Joined: 03-December 10

Re: read and write from text to excel file

Posted 08 August 2012 - 09:56 AM

You may write your data into CSV format
A, B, C, D

then use your excel program, import that csv file, then you will get a excel file

CSV http://en.wikipedia....eparated_values

This post has been edited by atraub: 08 August 2012 - 12:30 PM
Reason for edit:: Changed cvs to csv

Was This Post Helpful? 0
  • +
  • -

#5 atraub  Icon User is offline

  • Pythoneer
  • member icon

Reputation: 756
  • View blog
  • Posts: 1,990
  • Joined: 23-December 08

Re: read and write from text to excel file

Posted 08 August 2012 - 12:32 PM

Until you show some miniscule attempt at solving it, I will not help you. That would be violating the #1 fundamental rule of Dream In Code. Please, show us something.

This post has been edited by atraub: 08 August 2012 - 12:32 PM

Was This Post Helpful? 1
  • +
  • -

#6 jon.kiparsky  Icon User is online

  • Pancakes!
  • member icon


Reputation: 7292
  • View blog
  • Posts: 12,102
  • Joined: 19-March 11

Re: read and write from text to excel file

Posted 08 August 2012 - 12:55 PM

@FamiHug is correct, csv is the easiest way to do this. For each row of data, construct a string containing the values in the order you want them, separated by commas.
Technically, you don't have to use commas, any single character will do, so you might want to use, for example, tabs ("\t") or vertical bars ("|") if there's a chance you'll have commas in your data (for example, in the address field).

It would be wise to ensure that your data fields don't contain your separator character, in any case, because that would cause an annoying misalignment of your data.

But, as Adam says, if you want help with the code you'll have to start by writing it.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1