Python Forum
How to ignore formulas when reading excel file - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: How to ignore formulas when reading excel file (/thread-20533.html)



How to ignore formulas when reading excel file - SriMekala - Aug-16-2019

Hi,
I am reading an excel file which has formulas in a few columns names. When read using pd.read_ecel, the column names are becoming 0, 0.1, 0.2 etc. This may be because the cell contain formulas, how to just read only the value and ignore formula.

import pandas as pd
import numpy as np
df = pd.read_excel('D:\input.xlsx',sheetname='Sheet2')



RE: How to ignore formulas when reading excel file - buran - Aug-16-2019

it looks like your file/data has no header row and it defaults to first line. I guess you don't want to skip the first row of data. you need to explicitly pass header=None when call pandas.read_excel()
https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.read_excel.html


RE: How to ignore formulas when reading excel file - SriMekala - Aug-16-2019

My input data is as below:

Caegory    Model			        TM		
	       Date	       WAT	 Actual	Date	    Standard	Cal
N22HN	   2019-07-07	7	 Fail	2019-08-01	Noraml	    5/9
	       2019-07-22	12	 1.36	2019-08-02	Struck	    2/1.3
	       2019-07-30	62/9 6/1	2019-08-03	Miss	    4
TM--> "=HYPERLINK("#Sheet2!A1","TM")"

I still want to keep all the columns.


RE: How to ignore formulas when reading excel file - buran - Aug-16-2019

IMHO the problem is that single header value e.g. Model Date is split in multiple rows, not that you have formulas.