0

I have multiple files in Directory cars.Csv Bus.Csv

enter image description here

I have script where it capturing Csv files and loading into New Csv file. But I want to read those files and load into new Csv file .

Sheet 1 : Cars.Csv data

Sheet 2 : Bus.Csv data

script :

import glob, os
import pandas as pd
df=pd.DataFrame(columns=['X'])
os.chdir("H:\Learning\MohanTest")
df['X']=glob.glob("*.csv")
df.to_csv('./files.csv',index = False)
2
  • CSV files don't have 'sheets', so there is no way of having two different tables in one CSV file. If your Cars and Bus have the same structure you may put them in one table together, but that's a different thing. Commented Jun 19, 2019 at 15:41
  • Csv or Excel I want to read those files and put the data into Excel work book which have sheet 1 and sheet 2 Commented Jun 19, 2019 at 15:50

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.