4

I need to change data in large excel file(more than 240 000 rows on sheet), it's possible through win32com.client, but I need use Linux OS ...

Please, could you advise something suitable!

Yu Hao
  • 119,891
  • 44
  • 235
  • 294
pupsik
  • 41
  • 1

2 Answers2

-1

If it's raw data, I always export it to a .csv file and work on it directly. CSV is a simple format with one row per line and all the elements on the row separated with commas. Depending on what you want to do, it's not hard to write a python script to edit that.

Ric
  • 581
  • 5
  • 26
  • 1
    This isn't really an answer to the question, rather a "do it this way instead"... – jmetz Oct 07 '15 at 16:02
  • @EricThomas - `xlrd` only works on old Excel files; `openpyxl` is the recommended library to edit Excel files (see http://www.python-excel.org/) – jmetz Oct 07 '15 at 16:05
  • What if the user needs to parse 1000 Excel files... why manually export when you have Excel file readers in Python? The output format might also need to be Excel files - manual export, process, manual import is a tedious workflow. – jmetz Oct 07 '15 at 16:14
  • 1
    Very Thanks! XLRD it's cool! The speed very fast! But i need to edit data in file, XLRD allowed me only read data, so i can use XLWD of course, but my excel files has some sheets containing lage data, and if i use XLRD/XLWD i will lose data from other sheets of my document. – pupsik Oct 15 '15 at 14:24
  • Use Xlwings to edit data in large files – virendra singh deora Feb 24 '22 at 07:10
-2

openpyxl is the recommended python module to use (see http://www.python-excel.org/ )

You can use openpyxl directly or pandas (see http://pandas.pydata.org/pandas-docs/stable/io.html) which wraps openpyxl offering a high level interface to the worksheet.

E.g.

df = pandas.read_excel(FILENAME)
# Manipulate data 
#...
df.to_excel(FILENAME)

See also

Community
  • 1
  • 1
jmetz
  • 12,144
  • 3
  • 30
  • 41