Is there is way to create sheet 2 in same csv file by using python code
Asked
Active
Viewed 4,516 times
0
-
Nope. https://stackoverflow.com/questions/29615196/is-csv-with-multi-tabs-sheet-possible – Mel Oct 06 '17 at 07:40
-
1Welcome to Stack Overflow! Please review [**How to ask**](https://stackoverflow.com/help/how-to-ask) questions on Stack Overflow and [what types of questions can be asked](https://stackoverflow.com/help/on-topic) and [what types should be avoided](https://stackoverflow.com/help/dont-ask) – bhansa Oct 06 '17 at 07:41
-
You need to expand your question. What data do you have (show examples) and what kind of output are you trying to achieve with it? – Martin Evans Oct 06 '17 at 10:09
-
I have a dictionary like {'First':1,'Second':2}.if i save this dictionary to **my_file.csv** by using DictWriter,my result will be stored in my_file.csv's **sheet 2** not in **sheet 1**.That is my question.Is possible to make this? – Ashok Ramesh Oct 06 '17 at 10:58
-
Did you get the answer for this @Ashok? – Harshit verma Oct 11 '19 at 12:14
2 Answers
1
yes. There is :
df = pd.read_excel("C:\\DWDM\\Status.xlsx") # read ur original file
workbook = load_workbook(filename="C:\\DWDM\\Status.xlsx")
ws2 = workbook.create_sheet("Summary", 0) # other sheet with name Summary is added to the same.
and you can check the same with "workbook.sheetnames"

Whatever
- 11
- 1
0
You can do this by using multiple CSV files - one CSV file per sheet.
A comma-separated value file is a plain text format. It is only going to be able to represent flat data, such as a table (or a "sheet")
When storing multiple sheets, you should use separate CSV files. You can write each one separately and import/parse them individually into their destination.

liam
- 1,918
- 3
- 22
- 28