{"id":99,"date":"2026-03-05T18:00:35","date_gmt":"2026-03-05T10:00:35","guid":{"rendered":"https:\/\/xlwings.net\/blog\/?p=99"},"modified":"2026-01-17T11:17:46","modified_gmt":"2026-01-17T11:17:46","slug":"how-to-bind-data-using-xlwings","status":"publish","type":"post","link":"https:\/\/xlwings.net\/blog\/how-to-bind-data-using-xlwings\/","title":{"rendered":"How To Bind Data Using xlwings?"},"content":{"rendered":"<h2>Method<\/h2>\n<p style=\"margin: 0in; font-family: \u5fae\u8f6f\u96c5\u9ed1; font-size: 14.0pt;\">There are three methods for binding data to a chart:<\/p>\n<p style=\"margin: 0in; font-family: \u5fae\u8f6f\u96c5\u9ed1; font-size: 8.0pt;\">\n<p style=\"margin: 0in; font-family: \u5fae\u8f6f\u96c5\u9ed1; font-size: 14.0pt;\">&#8211; Use the `Select` method on a cell range to select data.<\/p>\n<p style=\"margin: 0in; font-family: \u5fae\u8f6f\u96c5\u9ed1; font-size: 14.0pt;\">&#8211; Use the `SetSourceData` method of the `Chart` object to bind data.<\/p>\n<p style=\"margin: 0in; font-family: \u5fae\u8f6f\u96c5\u9ed1; font-size: 14.0pt;\">&#8211; Use the `ChartWizard` method in the API approach to bind data.<\/p>\n<p style=\"margin: 0in; font-family: \u5fae\u8f6f\u96c5\u9ed1; font-size: 8.0pt;\">\n<p style=\"margin: 0in; font-family: \u5fae\u8f6f\u96c5\u9ed1; font-size: 14.0pt;\">The `SetSourceData` method of the `Chart` object allows you to set the source data range for the specified chart. The syntax is as follows:<\/p>\n<p style=\"margin: 0in; font-family: \u5fae\u8f6f\u96c5\u9ed1; font-size: 8.0pt;\">\n<p style=\"margin: 0in; margin-left: .375in; font-size: 14.0pt;\"><span lang=\"en-US\" style=\"font-family: \u5fae\u8f6f\u96c5\u9ed1;\">cht.SetSourceData(Source,<\/span><span lang=\"x-none\" style=\"font-family: Arial;\">\u2002<\/span><span lang=\"en-US\" style=\"font-family: \u5fae\u8f6f\u96c5\u9ed1;\">PlotBy)<\/span><\/p>\n<p style=\"margin: 0in; font-family: \u5fae\u8f6f\u96c5\u9ed1; font-size: 8.0pt;\">\n<p style=\"margin: 0in; font-family: \u5fae\u8f6f\u96c5\u9ed1; font-size: 14.0pt;\">Here, `cht` is the generated `Chart` object, and the parameters are as follows:<\/p>\n<p style=\"margin: 0in; font-family: \u5fae\u8f6f\u96c5\u9ed1; font-size: 14.0pt;\">&#8211; `Source` \u2013 A `Range` object that specifies the source data range for the chart.<\/p>\n<p style=\"margin: 0in; font-family: \u5fae\u8f6f\u96c5\u9ed1; font-size: 14.0pt;\">&#8211; `PlotBy` \u2013 Specifies how the data is plotted. A value of 1 means the data is plotted by columns, and a value of 2 means it is plotted by rows.<\/p>\n<h2><\/h2>\n","protected":false},"excerpt":{"rendered":"<p>Method<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[],"class_list":["post-99","post","type-post","status-publish","format-standard","hentry","category-xlwings-chart"],"_links":{"self":[{"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/posts\/99","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/comments?post=99"}],"version-history":[{"count":2,"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/posts\/99\/revisions"}],"predecessor-version":[{"id":482,"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/posts\/99\/revisions\/482"}],"wp:attachment":[{"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/media?parent=99"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/categories?post=99"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/tags?post=99"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}