Cell coordinates should be provided as a string:

ws['A1'] = 'testing 1-2-3'

Or, if you want to use row and column indexes, use ws.cell().value:

ws.cell(row=1, column=1).value = 'testing 1-2-3'
Answer from alecxe on Stack Overflow
🌐
Reddit
reddit.com › r/learnpython › 'tuple' object has no attribute 'value'
r/learnpython on Reddit: 'tuple' object has no attribute 'value'
May 18, 2020 -

hii folks,

i am trying to write data to a excel file.when using for loop,to assign the values to cells,it's giving me the error that 'tuple' object has no attribute 'value' at line 6.

import openpyxl
wb=openpyxl.Workbook()
ws=wb.active
for i in range(10):
	index="A"+str(i)
	ws[index]=i

please help me this error.

🌐
Reddit
reddit.com › r/learnpython › extracting a value from range of excel cells
r/learnpython on Reddit: Extracting a value from range of Excel cells
May 15, 2017 -

I am attempting to extract some numerical data from an Excel spreadsheet. I have successfully extracted the cell locations into a tuple, but I am struggling when trying to extract the numbers from those cells.

Code:

from openpyxl import load_workbook

fileName = 'tempdata.xlsx'

wb = load_workbook(fileName)
sheet1 = wb.get_sheet_by_name("Sheet1")
tempData = sheet1['N3':'N11']

print (tempData)

this prints:

((<Cell Sheet1.N3>,), (<Cell Sheet1.N4>,), (<Cell Sheet1.N5>,), (<Cell Sheet1.N6>,), (<Cell Sheet1.N7>,), (<Cell Sheet1.N8>,), (<Cell Sheet1.N9>,), (<Cell Sheet1.N10>,), (<Cell Sheet1.N11>,))

instead of numbers. If I change 'N3':'N11' to only 'N3', and print tempData.value, it prints the value I'm looking for.

OS: Windows 10 Python 3.6

🌐
Reddit
reddit.com › r/learnpython › 'tuple' has no attribute 'value' problem
r/learnpython on Reddit: 'Tuple' has no attribute 'value' problem
October 8, 2020 -

Hello!

Trying to create an excel file that can be read for my bachelors project in college and I have a slight problem. I get "AttributeError: 'tuple' object has no attribute 'value'" and the program is really simple and all other people I have found that have problems with it are more complex than mine. I am a beginner to Python so be kind please.

Code:

from openpyxl import load_workbook
wb = load_workbook('Hello_World.xlsx')
ws = wb.active
col_a = ws['A'].value
print(col_a)

Error:

col_a = ws['A'].value

AttributeError: 'tuple' object has no attribute 'value'

🌐
Stack Overflow
stackoverflow.com › questions › 73185640 › cell-value-condition-for-loop-openpyxl-tuple-object-has-no-attribute-value
python 3.x - cell value condition for loop OpenPyxl /'tuple' object has no attribute 'value'/ - Stack Overflow
wb = load_workbook(example.xlsx) ws = wb.active for i in ws: if i != Date_COFTR: ws.append([Date_COFTR]) wb.save(example.xlsx) I am trying to append a date (the actual date val...
Find elsewhere
🌐
GitHub
github.com › alex-sherman › deco › issues › 25
AttributeError: 'Tuple' object has no attribute 'value' · Issue #25 · alex-sherman/deco
May 25, 2016 - runfile('/home/alexpetralia/Desktop/boston_events/main.py', wdir='/home/alexpetralia/Desktop/boston_events') Traceback (most recent call last): File "<ipython-input-4-b3482a262993>", line 1, in <module> runfile('/home/alexpetralia/Desktop/boston_events/main.py', wdir='/home/alexpetralia/Desktop/boston_events') File "/usr/lib/python3/dist-packages/spyderlib/widgets/externalshell/sitecustomize.py", line 586, in runfile execfile(filename, namespace) File "/usr/lib/python3/dist-packages/spyderlib/widgets/externalshell/sitecustomize.py", line 48, in execfile exec(compile(open(filename, 'rb').read()
Published   May 25, 2016
🌐
Stack Overflow
stackoverflow.com › questions › 66246080 › writing-to-multiple-cells-in-excel-using-python-but-get-error-message-tuple-h
Writing to multiple cells in excel, using python, but get error message: tuple has no attribute value - Stack Overflow
@C_Z_ this is what i get. self[key].value = value AttributeError: 'tuple' object has no attribute 'value' ... The cell_obj is referring to only one cell value and not to all 3 cells.
🌐
CopyProgramming
copyprogramming.com › howto › attributeerror-tuple-object-has-no-attribute-value-python-to-excel
Excel: Python to Excel: Handling AttributeError of 'tuple' object with no 'value' attribute
April 29, 2023 - PYTHON TO EXCEL: 'tuple' object does not have 'value' attribute causing AttributeError, Struggling with Python's AttributeError: 'tuple' object lacks 'value' attribute? Here's how to solve it, Error in openpyxl: 'value' attribute not found in 'tuple' object, AttributeError: 'tuple' object does ...
🌐
LearnDataSci
learndatasci.com › solutions › python-attributeerror-tuple-object-has-no-attribute
Python AttributeError: 'tuple' object has no attribute – LearnDataSci
Often this error occurs when using an external library where you didn't know a function returned a tuple. We'll describe examples of this below. If you create your own function and want your return value to have dot-access, you can use a namedtuple or a class.
🌐
Stack Overflow
stackoverflow.com › questions › 34658694 › how-to-get-the-actual-value-of-a-cell-with-openpyxl
csv - How to get the actual value of a cell with openpyxl? - Stack Overflow
January 8, 2016 - There is no error message but I only get the reference of the cell in csv file and changing it to dest_file.writerow(row.value) brings me back to the tuple error. I obviously still need your help! ... I found a way around it using numpy, which allows me to store my values as a list of lists rather than a list of tuples. import os, openpyxl, csv import numpy as np wb_source = openpyxl.load_workbook(filename, data_only=True) app_file = open(filename,'a') dest_file = csv.writer(app_file, delimiter=',', lineterminator='\n') calib_sheet = wb_source.get_sheet_by_name('Calibration') store = list(calib_sheet.iter_rows('B78:C88')) print store truc = np.array(store) print truc for i in range(11): for j in range(1): dest_file.writerow([truc[i][j].value, truc[i][j+1].value]) app_file.close()
🌐
Stack Overflow
stackoverflow.com › questions › 50238756 › python3-using-openpyxl-to-read-cells
python 3.x - Python3, using openpyxl to read cells - Stack Overflow
Thank you, Tc Zhong, for helping! The correct way to print the value is print(cell[0].value) ---------Here is the original question------------------ I am currently learning python to read from x...
🌐
Stack Overflow
stackoverflow.com › questions › 66300337 › how-can-i-solve-pythons-attributeerror-tuple-object-has-no-attribute-value
How can I solve Python's "AttributeError: 'tuple' object has no attribute 'value'"? - Stack Overflow
We cannot reproduce your problem, because we have no access to your files. So solemnly based on the error, I would say print s["B5":"M4"], which will be a tuple, in any case (item1, item2), instead of your expected item1 with the attribute value.
🌐
Google Groups
groups.google.com › g › openpyxl-users › c › b_lab_TB_yM
Issues using iter_rows
June 21, 2012 - iter_rows returns a tuple of cell, one per row. if you have a range that is 1-col wide, then you can do for row in ws.iter_rows(...): cell = row[0] if str(cell.value)......
🌐
Stack Overflow
stackoverflow.com › questions › 73674777 › tuple-typeerror-when-assigning-value-to-cell-in-openpyxl
python - Tuple TypeError when assigning Value to Cell in openpyxl - Stack Overflow
September 10, 2022 - Just for clarity; The active sheet the Sheet that has the focus when it comes to executing an action at the current point in time. It contains the 'active cell', ie the cell that the action will be performed on. There is only one active cell and sheet per workbook at any time so wb.active is never used to select a sheet by name or number but only to select this active sheet. Its use is only ever var = <Workbook()>.active. Putting the [1] at the end changed the variable 'ws' to a tuple representing a cell.