Answers for "xlsx to python"

6

python how to read a xlsx file

import pandas as pd

df = pd.read_excel (r'Path where the Excel file is storedFile name.xlsx')
print (df)
Posted by: Guest on August-14-2020
0

xls in python

>>> from openpyxl import Workbook
>>> wb = Workbook()
>>> ws = wb.active
>>> for i in range(10):
...     ws.append([i])
>>>
>>> from openpyxl.chart import BarChart, Reference, Series
>>> values = Reference(ws, min_col=1, min_row=1, max_col=1, max_row=10)
>>> chart = BarChart()
>>> chart.add_data(values)
>>> ws.add_chart(chart, "E15")
>>> wb.save("SampleChart.xlsx")
Posted by: Guest on June-12-2021

Python Answers by Framework

Browse Popular Code Answers by Language