normally when we use the read function we get data only we don't get comments, sometimes those comments are also important for analysis, so any heads up would be helpful. Thank You
1 Answer
comments normally are on few random cell, hence you may have to loop through rows and cells to capture comments and Pandas may not help you, you may use openpyxl to do this
from openpyxl import load_workbook
workbook = load_workbook('yourexcel.xlsx')
sheet1 = workbook.get_sheet_names()[0]
worksheet = workbook.get_sheet_by_name(sheet1)
for row in worksheet.iter_rows():
for cell in row:
if cell.comment:
print(cell.comment.text)
1 Comment
chinna venkat
okay seems a bit helpful, but I can't see my data and without data, there it's difficult looking|extracting the comments.
read()function? they exist in many libraries.... if you mean pandas.pydata.org/pandas-docs/stable/reference/api/… it will read all data, if some of the columns are comments they will be read