openpyxl Questions

13

Solved

The new version of Pandas uses the following interface to load Excel files: read_excel('path_to_file.xls', 'Sheet1', index_col=None, na_values=['NA']) but what if I don't know the sheets that ar...
Garibald asked 31/7, 2013 at 17:57

8

Solved

Is there any method to get the number of rows and columns present in .xlsx sheet using openpyxl ? In xlrd, sheet.ncols sheet.nrows would give the column and row count. Is there any such met...
Zucker asked 15/2, 2016 at 11:36

3

Solved

I am using python 2.7.10 and openpyxl 2.3.2 and I am a Python newbie. I am attempting to apply a border to a specified range of cells in an Excel worksheet (e.g. C3:H10). My attempt below is faili...
Gendron asked 29/12, 2015 at 23:30

6

In openpyxl, you can set a hyperlink like this: cell.hyperlink = r'..\somedir\somefile.txt' However, this does not apply the hyperlink style that you would get when setting a hyperlink in Excel...
Xantho asked 26/9, 2015 at 21:40

3

Solved

I want to delete a sheet from my Excel file and i am trying this code: import openpyxl workbook1 = openpyxl.load_workbook(input_file_folder + input_file_name) print(workbook1.sheetnames) Sheet1 =...
Ligate asked 28/10, 2019 at 4:36

3

Solved

My xlsx file has 5 sheets, I can change fourth sheet content, after change, I save to a new file. But when I open the new file, I need manual to select the fourth sheet. How can I change the defa...
Kura asked 7/1, 2016 at 9:33

5

Solved

In Python with openpyxl I'd like to change the active cell when the user opens the spreadsheet. This produces 'A1': print("Active Cell: " + WorkSheetOne.sheet_view.selection[0].activeCell) Thi...
Brittbritta asked 24/1, 2018 at 17:20

6

ubuntu 18.04, python3.8 and using pycharm. Interpreter path in pychamr is correctly set. while trying to read specific sheet in excel, using openpyxl it keeps on giving me ImportError. ImportError:...
Shade asked 13/5, 2021 at 2:55

13

Solved

I'm looking for the best approach for inserting a row into a spreadsheet using openpyxl. Effectively, I have a spreadsheet (Excel 2007) which has a header row, followed by (at most) a few thousand...
Quincey asked 25/6, 2013 at 14:0

5

openpyxl seems to be a great method for using Python to read Excel files, but I've run into a constant problem. I need to detect whether a cell is empty or not, but can't seem to compare any of the...
Somber asked 26/10, 2011 at 19:40

3

Solved

I would like to copy-paste the formula from one cell to another using openpyxl with the transposition you usually get when you use Excel. For example, copying the formula =SUM(J3:J18) to the next ...
Tarn asked 30/1, 2017 at 8:43

4

Solved

This bug suddenly came up literally today after read_excel previously was working fine. Fails no matter which version of python3 I use - either 10 or 11. Do folks know the fix? File "/Users/a...
Transport asked 13/2, 2023 at 19:20

3

Solved

The following is a simple snippet to open a .xlsm file, write a few values to it with python, and save it. import openpyxl from openpyxl import load_workbook def toExcel(): wb = load_workbook(f...
Clancy asked 3/7, 2016 at 20:2

2

Solved

I'm creating an excel sheet using openpyxl. Some cells represent monetary values. How can I change the format of a cell to be of type "currency", i.e. I want a "€" symbol to be displayed after the ...
Musket asked 7/1, 2016 at 10:5

8

Solved

I'm using the module openpyxl for Python and am trying to create a hyperlink that will take me to a different tab in the same Excel workbook. Doing something similar to the following creates the hy...
Pepsinogen asked 7/5, 2015 at 19:55

21

Solved

I have following script which is converting a CSV file to an XLSX file, but my column size is very narrow. Each time I have to drag them with mouse to read data. Does anybody know how to set column...
Annabal asked 2/11, 2012 at 14:50

2

Solved

How to freeze entire header row in openpyxl? So far I can only freeze the column: # only freeze the column (freeze vertically) cell = ws.cell('{}{}'.format(col, row_idx+1)) worksheet.freeze_pane...
Michellmichella asked 31/8, 2014 at 4:21

5

Solved

I have been testing adding a table to a worksheet using openpyxl, but I get the error below when I try to open it. The file opens, but the formatting isn't correct. After hitting recover, excel rep...
Schaefer asked 10/6, 2020 at 9:27

21

I am being asked to generate some Excel reports. I am currently using pandas quite heavily for my data, so naturally I would like to use the pandas.ExcelWriter method to generate these reports. How...
Helminthology asked 26/6, 2013 at 17:44

4

Solved

Using the latest packages version: openpyxl: 3.0.6 | pandas: 1.2.3 |python: 3.9 The function below was working fine before updating the packages above to the latest version reported. Now it raises ...
Reich asked 8/3, 2021 at 14:13

2

Solved

I have a spreadsheet that I am generating with openpyxl that contains a number of system checks. Based on the rules; the words Pass, Fail or Informational are inserted into Column E in my spreadshe...
Misapply asked 9/7, 2015 at 18:45

3

Solved

This code used to get a xlsx file and write over it, but after updating from pandas 1.1.5 to 1.5.1 I got zipfile.badzipfile file is not a zip file Then I read here that after pandas 1.2.0 the pd.Ex...
Ode asked 10/11, 2022 at 2:5

4

Solved

I am writing some data into an Excel file, but I don’t know how to adjust the code in order to be able to control which sheet I am writing into: from openpyxl import load_workbook wb = load_workbo...
Bellyful asked 23/4, 2016 at 17:22

3

Solved

I can read an Excel file from pandas as usual: df = pd.read_excel(join("./data", file_name) , sheet_name="Sheet1") I got the following error: ValueError: Value must be either ...
Fife asked 8/2, 2023 at 14:57

5

Why do I receive this warning message every time I run my code? (below). Is it possible to get rid of it? If so, how do I do that? My code: from openpyxl import load_workbook from openpyxl import...
Rooted asked 16/12, 2015 at 21:16

© 2022 - 2025 — McMap. All rights reserved.