Home > Blockchain >  What is an efficient way to make excel report from python?
What is an efficient way to make excel report from python?

Time:03-04

For the report I use this code:

from openpyxl import load_workbook

ReportName = "tets.xlsx"
new_row_data = [
    ["value", 'value2', "value3"]] 
wb = load_workbook(ReportName)

# Select Second Worksheet 
ws = wb.worksheets[1]

# Append 1 or 2(if multiple) new Rows - Columns A - D
for row_data in new_row_data:
     # Append Row Values
     ws.append(row_data)
wb.save(ReportName) #save the file

It has no errors, but I don't understand why sometimes it doesn't make the report inside the excel file, it saves the excel file, then when I open it, I don't see the values. Do you know a better way or more solid way to make the auto report?

CodePudding user response:

I would recommend using CSV files, that can be loaded into excel. Python is really great at working with CSVs. Here is a link that might be useful.

[https://docs.python.org/3/library/csv.html][1]

  • Related