Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

Importing data to python program from excel

python excel import export data function

Best Answer thunderspeed, 26 October 2014 - 08:31 AM

I did that , still xlwt doesn't want to install  :irritated:


Problem solved ,

xlwt is not compatible with python 3.4

I downloaded and installed xlwt-future  :thumbup1:

thanks again guys for your helpful comments

Go to the full post


This topic has been archived. This means that you cannot reply to this topic.
9 replies to this topic

#1 thunderspeed

thunderspeed

    CC Lurker

  • New Member
  • Pip
  • 4 posts

Posted 24 October 2014 - 03:01 AM

Hi , 
I need some help with this please ,
I created a code in python and I want to execute it with input from a large excel file .
I want the input extracted to be put in a function like this in the python code : gosub.eq3(tdb_tr,rh_tr,p) ,,,, so tdb_tr and rh_tr are taken from different columns and rows of the excel sheet .
I also want python to reprint the output (number) for each combination of values in an excel sheet row by row .
Does anyone know how can i do that ?
Thanks in advance
 


#2 JonElias

JonElias

    CC Addict

  • Advanced Member
  • PipPipPipPipPip
  • 201 posts

Posted 24 October 2014 - 10:26 AM

page 7 of this pdf file:

http://www.simplisti...ython-excel.pdf

 

helpful?

 

by the way welcome aboard :)


Edited by JonElias, 24 October 2014 - 10:26 AM.

"computers are useless they only give you answers" Pablo Picasso
And yes he was alive when the first programmable computer was made

#3 BlackRabbit

BlackRabbit

    CodeCall Legend

  • Expert Member
  • PipPipPipPipPipPipPipPip
  • 3871 posts

Posted 24 October 2014 - 09:22 PM

Welcome aboard!

 

In addition to Jon's help here is an old Codecall thread in the matter



#4 thunderspeed

thunderspeed

    CC Lurker

  • New Member
  • Pip
  • 4 posts

Posted 25 October 2014 - 04:15 AM

Thank you JonElias and black rabbit ,

I downloaded the libraries . Unfortunately I can't understand how to install it in JonElias' pdf . It says you can install it with easy install and with buildout and where installing any of those two first is a big mess for a beginner. I'm searching youtube right now for the method of installation .

Thanks again


Edited by thunderspeed, 25 October 2014 - 04:16 AM.


#5 JonElias

JonElias

    CC Addict

  • Advanced Member
  • PipPipPipPipPip
  • 201 posts

Posted 25 October 2014 - 06:13 AM

Windows?
If so:
You just go to the pypi website for the file. Dowload the tar.gz file. Unzip it with winrar (http://www.rarlab.com/download.htm). Go to cmd nagivate to the folder where you unzipped it, execute the setup.py with python setup.py install, that wil work if you have set the enviroment varable. You cannagivate to the folder you downloaded, if you open it in windows explorer and copy the adress from the adress line on the top of the window. Then go too cmd and do: cd (adress goes here), and then python setup.py install. I will sit down and write it more clearly for you if tis didnt help you

Edited by JonElias, 25 October 2014 - 06:18 AM.

"computers are useless they only give you answers" Pablo Picasso
And yes he was alive when the first programmable computer was made

#6 gonerogue

gonerogue

    CC Addict

  • Advanced Member
  • PipPipPipPipPip
  • 197 posts

Posted 25 October 2014 - 06:49 AM

The de-facto method to install python third party packages is via pip

In general you should prefer using pip to install packages.

If you use python 3.4.x and up, you already have pip. Otherwise, you need to install it.

 

To install pip on windows:

1. Copy the get-pip.py script from here https://bootstrap.pypa.io/get-pip.py

2. In Command Prompt, execute:

    python get-pip.py

3. Add the scripts directory, from you python install location, in PATH (if not already there).

 

To install pip on linux, use your package manager.

For exemple, on Debian derived distributions (such as ubuntu), execute from a terminal:

sudo apt-get install pip

pip install --upgrade pip

 

After you installed pip, you can install every package on pypi (https://pypi.python.org/pypi) as following:

pip install your_package_name

 

In your case, execute:

pip install xlrd

 

This will automatically download and install that package.

 

The advantage is that once you have pip installed, you don't need to manually search, download the third-party packages, unpack them and install them. You just need to execute only one command in the command prompt/terminal.

 

Note: you have to manually install pip only once. After that, you can always use pip to upgrade itself to the latest version by executing:

 

pip install --upgrade pip

 

More info aput pip:

https://pip.pypa.io/en/latest/

 

Good luck.


Edited by gonerogue, 25 October 2014 - 07:03 AM.


#7 JonElias

JonElias

    CC Addict

  • Advanced Member
  • PipPipPipPipPip
  • 201 posts

Posted 25 October 2014 - 07:24 AM

Or you could install pip

nice answer gonerouge,


Edited by JonElias, 25 October 2014 - 12:10 PM.

"computers are useless they only give you answers" Pablo Picasso
And yes he was alive when the first programmable computer was made

#8 thunderspeed

thunderspeed

    CC Lurker

  • New Member
  • Pip
  • 4 posts

Posted 25 October 2014 - 09:46 AM

Guys ,

first I'd like to thank each of you very much 

I had no problems installing xlrd through pip

The process went fine and my code is taking inputs from the excel sheet .

 

The problem I'm facing right now is in the xlwt when I come to install it the same way it gives me an error :

Comman python setup,py egg_info failed with error code 1 in C:\Users\THESIS\App ...(etc)...\xlwt

Storing debug log for failure in C:\Users\THESIS\pip\pip.log



#9 BlackRabbit

BlackRabbit

    CodeCall Legend

  • Expert Member
  • PipPipPipPipPipPipPipPip
  • 3871 posts

Posted 25 October 2014 - 10:03 PM

Not easy days, are they?  Check setuptools, read about it in here



#10 thunderspeed

thunderspeed

    CC Lurker

  • New Member
  • Pip
  • 4 posts

Posted 26 October 2014 - 08:31 AM   Best Answer

I did that , still xlwt doesn't want to install  :irritated:


Problem solved ,

xlwt is not compatible with python 3.4

I downloaded and installed xlwt-future  :thumbup1:

thanks again guys for your helpful comments






Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download