This tutorial will show you how to separate Excel Data into Workbooks by Column Values. Instead of VBA, we will be using Python and the Pandas Library. The Python code from this tutorial can be a huge time saver. You can apply the code from this tutorial also any other Excel – you just need to tweak it slightly.
Download all the files from the tutorial [Google Drive]:
👉 https://bit.ly/3himlrI
👩💻 Full code from the video:
import pandas as pd # pip install pandas
import os
df = pd.read_excel('NAME_OF_WORKBOOK.xlsx')
column_name = 'NAME_OF COLUMN'
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(os.getcwd(), str(unique_value) + '.xlsx')
df_output.to_excel(output_path, sheet_name=unique_value, index=False)
Subscribe: https://www.youtube.com/c/CodingIsFun/featured
#python #excel