Aug-06-2024, 04:13 PM
I'm trying to find in Activities[1:30000] the 1st cell that matches Report[1, 0] and remember that cell address. Then copy Report[1:30000, 0:37] and paste, values only, starting in the matched cell. A friend gave me this code, but it doesn't work. Column A in both workbooks is named the same and sorted ascending. Activities.xlsx is a table, extending past [37] from [38:52]. The 'Paste values only' needs to be contained in [0:37] so as not to erase formulas in [38:52].
Any assistance would be greatly appreciated.
Sick
Here is the code I'm working from:
Any assistance would be greatly appreciated.
Sick
Here is the code I'm working from:
import pandas as pd report_df = pd.read_csv('Report.csv') activities_df = pd.read_excel('Activities.xlsx') value_to_match = report_df.iloc[1, 0] match_index = activities_df.iloc[1:30000].eq(value_to_match).stack().idxmax() match_row, match_col = match_index copied_data = report_df.iloc[1:30000, 0:37] rows_available = activities_df.shape[0] - match_row cols_available = activities_df.shape[1] - match_col activities_df.to_excel('Activities.xlsx', index=False)