Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to create a new xlsx file using openpyxl?

Does anybody knows how to create a new xlsx file using openpyxl in python?

filepath = "/home/ubun/Desktop/stocksinfo/yyy.xlsx"
wb = openpyxl.load_workbook(filepath)
ws = wb.get_active_sheet()

What do I need to add?

like image 855
Newboy11 Avatar asked Aug 08 '15 12:08

Newboy11


1 Answers

I'm sorry my head is turning around. :) This solves the problem

filepath = "/home/ubun/Desktop/stocksinfo/test101.xlsx"
wb = openpyxl.Workbook()

wb.save(filepath)

This will create a new file.

like image 131
Newboy11 Avatar answered Sep 29 '22 11:09

Newboy11