0

Is there is way to create sheet 2 in same csv file by using python code

5
  • Nope. stackoverflow.com/questions/29615196/… Commented Oct 6, 2017 at 7:40
  • 1
    Welcome 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 avoided Commented 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? Commented 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? Commented Oct 6, 2017 at 10:58
  • Did you get the answer for this @Ashok? Commented Oct 11, 2019 at 12:14

2 Answers 2

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"

Sign up to request clarification or add additional context in comments.

Comments

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.

1 Comment

Can you give me a example?

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.