Reading Many Files into One Clean Table
Combine monthly exports with different layouts.
The Open buttons send the prompt text as currently shown below to that site only when you click. Fill in the placeholders first.
Combine many files into one table. File names and layout differences: [FILE_LIST_AND_DIFFERENCES]. Sample headers from three files: [SAMPLE_HEADERS]. Output I need: [OUTPUT_SPEC]. Produce: 1. An inventory step: code to list files, read only the header of each, and show a table of which columns appear in which file, so I can see renamed, missing, and extra columns before combining. 2. A column mapping dictionary (old name to standard name) with a column for the file group it applies to, and a rule for unmapped columns (stop and report, do not drop silently). 3. The loading function: explicit dtypes, parse dates, encoding fallback, skip rows, and a source_file column plus the row number in the file. 4. The concatenation with a check that the total rows equals the sum of rows per file. 5. Validation per file: totals that should match a control figure, date ranges that should not overlap, and duplicates across files. 6. A log of problems that is written to a file. Warn about encoding issues, trailing summary rows, and locale-specific decimal commas.
Fill in before use
Optional: type your details and the prompt above updates. Nothing is saved or sent.
Replace each bracketed placeholder with your own details, then paste into Any AI or another assistant.