Is there is way to create sheet 2 in same csv file by using python code
-
Nope. stackoverflow.com/questions/29615196/…Mel– Mel2017-10-06 07:40:42 +00:00Commented Oct 6, 2017 at 7:40
-
1Welcome to Stack Overflow! Please review How to ask questions on Stack Overflow and what types of questions can be asked and what types should be avoidedbhansa– bhansa2017-10-06 07:41:01 +00:00Commented Oct 6, 2017 at 7: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– Martin Evans2017-10-06 10:09:51 +00:00Commented Oct 6, 2017 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– Ashok Ramesh2017-10-06 10:58:53 +00:00Commented Oct 6, 2017 at 10:58
-
Did you get the answer for this @Ashok?Harshit verma– Harshit verma2019-10-11 12:14:14 +00:00Commented Oct 11, 2019 at 12:14
Add a comment
|
2 Answers
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"
Comments
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.
1 Comment
Ashok Ramesh
Can you give me a example?