Avatar of Wm Allen Smith
Wm Allen Smith
 asked on

Python Append/ Insert Filenames to Existing CSV

I have a process that loops through a source folder, goes to a particular sheet in  each workbook, and extracts row data  from that specified sheet, creates a dataframe and saves the data to a csv file. Is there a way to append  /insert into the csv  file    the file names of each file in the  source folder with out having to write that info into the source files?
* pandasPython

Avatar of undefined
Last Comment
Arana (G.P.)

8/22/2022 - Mon
Norie

Do you mean you want to add a column to the dataframe to hold the file the row of data came from?
Wm Allen Smith

ASKER
Norrie,
Yes , that is correct-- I want to add a field in the dataframe to hold the name of the each file from the source folder.
ASKER CERTIFIED SOLUTION
Arana (G.P.)

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Your help has saved me hundreds of hours of internet surfing.
fblack61