i am using "import xlwt" to create new excel sheet but it is throwing the following error?
Traceback (most recent call last):
File "xl.txt", line 1, in
import xlwt
ImportError: No module named xlwt
How to solve this problem ?
You need to install package xlwt.
You will get the package here
Related
I am using ubuntu and as a result unable to use ms excel.Anyways I have created a spread sheet and I wish to make use of it in my python program.
Following is the Python program.
import pandas as pd
df=pd.read_excel("/home/files/file1.ods")
df.head()
Traceback (most recent call last):
File "spreadsheet.py", line 2, in <module>
df=pd.read_excel("/home/files/file1.ods")
File "/usr/lib/python3/dist-packages/pandas/io/excel.py", line 163, in read_excel
io = ExcelFile(io, engine=engine)
File "/usr/lib/python3/dist-packages/pandas/io/excel.py", line 187, in __init__
import xlrd # throw an ImportError if we need to
ImportError: No module named 'xlrd'
Does it mean that I have to use ms excel or is there an error in my understanding.Whatever be the case your help will be highly appreciated.
In recent versions (since 0.25) of Pandas, this feature is provided.
Just install the odfpy package (with pip install odfpy or etc) and then use pandas' (sadly) read_excel() function with the engine='odf' option. For example:
pd.read_excel('path_to_file.ods', engine='odf')
See https://pandas.pydata.org/pandas-docs/stable/user_guide/io.html#opendocument-spreadsheets.
In centos I did pip install pandas. Everything looked successful.
However when I import pandas I get:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named pandas
Not sure how to fix. Also sys.modules is also showing no pandas.
I'm trying to learn xlwings for in Windows 7 but I get the following error when importing the xlwings module in python IDLE
>>> import xlwings
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
import xlwings
ImportError: No module named 'xlwings'
>>>
I installed Python using the Anaconda distribution and path variable correctly includes the site-packages
C:\Users\xxx\Anaconda3\Lib\site-packages;
I'm using Excel 2013. Any ideas?
When I try to load a workbook in Python 3.3 using openpyxl, I get a "No module named 'StringIO'" error:
In [5]: load_workbook(FileName)
Traceback (most recent call last):
File "<ipython-input-6-c4f3bc35f522>", line 1, in <module>
load_workbook(FileName)
File "C:\WinPython-64bit-3.3.2.3\python-3.3.2.amd64\lib\site-packages\openpyxl-1.6.2-py3.3.egg\openpyxl\reader\excel.py", line 112, in load_workbook
f = repair_central_directory(filename, is_file_instance)
File "C:\WinPython-64bit-3.3.2.3\python-3.3.2.amd64\lib\site-packages\openpyxl-1.6.2-py3.3.egg\openpyxl\reader\excel.py", line 59, in repair_central_directory
from StringIO import StringIO
ImportError: No module named 'StringIO'
I am aware that StringIO is not available in Python 3, but then again, I am using the py3.3 version of openpyxl (or so I think...?). However, when I try to find the file that calls StringIO, it is not in the directory noted in the traceback. Have I installed something incorrectly? Or is something else going on here?
Thanks in advance.
This should have been resolved in openpyxl 1.7
I unzipped xlwt and tried to install from that directory, but I get the following error.
>> python setup.py install
Traceback (most recent call last):
File "setup.py", line 4, in <module>
from xlwt import __VERSION__
File "C:\Users\mypc\Desktop\xlwt-0.7.5\xlwt\__init__.py", line 3, in <module>
from Workbook import Workbook
ImportError: No module named 'Workbook'
Here's the init.py that's giving the error
__VERSION__ = '0.7.5'
from Workbook import Workbook
from Worksheet import Worksheet
from Row import Row
from Column import Column
from Formatting import Font, Alignment, Borders, Pattern, Protection
from Style import XFStyle, easyxf, easyfont, add_palette_colour
from ExcelFormula import *
Anyone know what's causing this error? I need xlwt to write to excel spreadsheets!
xlwt is Python 2.x compatable, and does not seem to work on Python 3.x. "xlwt-future" is a fork of xlwt that works for Python 3:
pip install xlwt-future
I just installed a different version of xlwt and it worked.