Hi All,
I have a Masterfile which I split with the help of codes. Below is the code I use for splitting the excel file based on a column.
I have a Masterfile which I split with the help of codes. Below is the code I use for splitting the excel file based on a column.
import pandas as pd #pip install pandas import os df = pd.read_excel('CE Version - Drewry December Masterfile - v5.xlsx') column_name = 'Member Name' unique_values = df[column_name].unique() for unique_value in unique_values: df_output = df[df[column_name].str.contains(unique_value)] output_path = os.path.join('output',unique_value + '.xlsx') df_output.to_excel(output_path, sheet_name=unique_value, index=False)Question:- I want the data in splited files from row 17. Means top 16 rows should be empty in each splited files. And, I want to add one empty sheet as well in each splited files. How is it possible ?
Larz60+ write May-13-2022, 09:03 AM:
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
I fixed your indentation as well, please check that it's in proper place. Thank you.
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
I fixed your indentation as well, please check that it's in proper place. Thank you.