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?
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?
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.
Documentation site contains quickstart on front page.
Install and Import openpyxl
import openpyxl
Create new workbook
wb = openpyxl.Workbook()
Get SHEET name
Sheet_name = wb.sheetnames
Save created workbook at same path where .py file exist
wb.save(filename='Test.xlsx')
This is covered in the documentation: https://openpyxl.readthedocs.io/en/stable/tutorial.html#saving-to-a-file
wb.save(…)