'how to create a new sheet in existing csv file using python and add some data into that

i want to add a new sheet in existing CSV file with sheet name "summary" and write some data into the newly created sheet using python.



Solution 1:[1]

CSV is an acronym for "Comma Separated Values". It is not a table of any type, it's just what its name tells: multiple values, separated by commas. Excel and other table-processing utils has an ability to interpret this values as a table. And, since Excel keeps its tables organised as sheets, it will display your CSV as a table sheet. However CSV has no info about sheets at all. Sheets are not part of the CSV format. Related question can be found here.

As a possible solution, you may create a separate CSV for each sheet you'd like to use. That is not exactly what you want, but is similar to it.

Solution 2:[2]

CSV files don't have sheets. Maybe use you could use Excel instead if you really want multiple sheets, however in my opinion multiple CSV files are a more straightforward alternative.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 ??????? ????????
Solution 2 Michael Hodel