{"id":50,"date":"2026-02-11T18:11:44","date_gmt":"2026-02-11T10:11:44","guid":{"rendered":"https:\/\/openpyxl.com\/blog\/?p=50"},"modified":"2026-01-16T07:39:19","modified_gmt":"2026-01-16T07:39:19","slug":"how-to-set-data-points-in-series-using-openpyxl","status":"publish","type":"post","link":"https:\/\/openpyxl.com\/blog\/how-to-set-data-points-in-series-using-openpyxl.html","title":{"rendered":"How To Set Data Points in Series Using OpenPyXL?"},"content":{"rendered":"<h2>Method<\/h2>\n<p>#Modify point properties in the first series<\/p>\n<p>chart.series[0].marker.symbol=&#8217;triangle&#8217;<\/p>\n<p>chart.series[0].marker.size=10<\/p>\n<p>dp=DataPoint(idx=2,marker=Marker(size=16,symbol=&#8217;diamond&#8217;))\u00a0 #size\u00a0 max 72<\/p>\n<p>chart.series[0].data_points=[dp]<\/p>\n<h2>Sample Code<\/h2>\n\n\n<pre class=\"wp-block-code\"><code>#Points in the Series\n\nfrom openpyxl import Workbook, load_workbook\nfrom openpyxl.chart import LineChart, Reference\nfrom openpyxl.chart.marker import DataPoint,Marker\n\n# Read the file\nwb=load_workbook('Sales.xlsx')\n# Select the first worksheet\nws=wb.worksheets&#91;0]\n\n# Get the data from the range B1:D6 and save it as a Reference object\ndata=Reference(ws, min_col=2, min_row=1, max_col=4, max_row=6)\n# Get the data from the range A2:A6 for the x-axis of the bar chart\nlabels=Reference(ws, min_col=1, min_row=2, max_col=1, max_row=6)\n\n# Create a bar chart object\nchart=LineChart()\n# Set the data source\nchart.add_data(data, titles_from_data=True)\n# Set x-axis labels\nchart.set_categories(labels)\n\n#Modify point properties in the first series\nchart.series&#91;0].marker.symbol='triangle'\nchart.series&#91;0].marker.size=10\ndp=DataPoint(idx=2,marker=Marker(size=16,symbol='diamond'))  #size  max 72\nchart.series&#91;0].data_points=&#91;dp]\n\n# Insert the chart into the worksheet\nws.add_chart(chart, 'E3')\n# Save the workbook\nwb.save('test.xlsx')<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"872\" height=\"680\" src=\"https:\/\/openpyxl.com\/blog\/wp-content\/uploads\/2026\/02\/32.png\" alt=\"Set Data Points in Series Using OpenPyXL\" class=\"wp-image-320\" srcset=\"https:\/\/openpyxl.com\/blog\/wp-content\/uploads\/2026\/02\/32.png 872w, https:\/\/openpyxl.com\/blog\/wp-content\/uploads\/2026\/02\/32-300x234.png 300w, https:\/\/openpyxl.com\/blog\/wp-content\/uploads\/2026\/02\/32-768x599.png 768w\" sizes=\"auto, (max-width: 706px) 89vw, (max-width: 767px) 82vw, 740px\" \/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>OpenPyXL<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[],"class_list":["post-50","post","type-post","status-publish","format-standard","hentry","category-openpyxl-chart"],"_links":{"self":[{"href":"https:\/\/openpyxl.com\/blog\/wp-json\/wp\/v2\/posts\/50","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/openpyxl.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/openpyxl.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/openpyxl.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/openpyxl.com\/blog\/wp-json\/wp\/v2\/comments?post=50"}],"version-history":[{"count":2,"href":"https:\/\/openpyxl.com\/blog\/wp-json\/wp\/v2\/posts\/50\/revisions"}],"predecessor-version":[{"id":321,"href":"https:\/\/openpyxl.com\/blog\/wp-json\/wp\/v2\/posts\/50\/revisions\/321"}],"wp:attachment":[{"href":"https:\/\/openpyxl.com\/blog\/wp-json\/wp\/v2\/media?parent=50"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/openpyxl.com\/blog\/wp-json\/wp\/v2\/categories?post=50"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/openpyxl.com\/blog\/wp-json\/wp\/v2\/tags?post=50"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}