Python Forum

Full Version: How to ignore formulas when reading excel file
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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')
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/st...excel.html
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.
IMHO the problem is that single header value e.g. Model Date is split in multiple rows, not that you have formulas.