How to remove the entire blank row from the existing Excel Sheet using Python?
I need a solution which DOES NOT : Include reading the whole file and rewriting it without the deleted row.
IS THERE ANY DIRECT SOLUTION?
How to remove the entire blank row from the existing Excel Sheet using Python?
I need a solution which DOES NOT : Include reading the whole file and rewriting it without the deleted row.
IS THERE ANY DIRECT SOLUTION?
I achieved using Pandas package....
import pandas as pd
#Read from Excel
xl= pd.ExcelFile("test.xls")
#Parsing Excel Sheet to DataFrame
dfs = xl.parse(xl.sheet_names[0])
#Update DataFrame as per requirement
#(Here Removing the row from DataFrame having blank value in "Name" column)
dfs = dfs[dfs['Name'] != '']
#Updating the excel sheet with the updated DataFrame
dfs.to_excel("test.xls",sheet_name='Sheet1',index=False)
dfs = dfs[dfs['Name'] != ''] is giving a type error TypeError: invalid type comparison.