Reputation: 45
I want to add an empty row to all of my excel files using python pandas.
I leave you an example so you can understand.
I have this: Excel example
And I want to add this row before name and city: Example
I need to do that, but not opening the excels files cause this is just a small example of what I really need.
Thanks!
Upvotes: 1
Views: 5135
Reputation: 71
You can use startrow for this
writer = pd.ExcelWriter('demo.xlsx') df.to_excel(writer, sheet_name='Concentrado',startrow=1, startcol= 1, encoding='utf-8')
Upvotes: 4
Reputation: 210912
Demo:
In [107]: df
Out[107]:
a b
0 a zzz
1 b yyy
In [108]: pd.DataFrame([[''] * len(df.columns)], columns=df.columns).append(df)
Out[108]:
a b
0
0 a zzz
1 b yyy
Upvotes: 1