{"id":8496,"date":"2024-03-14T08:12:36","date_gmt":"2024-03-14T08:12:36","guid":{"rendered":"https:\/\/www.silicloud.com\/blog\/how-can-python-read-an-excel-file-and-manipulate-the-data\/"},"modified":"2025-08-03T05:46:56","modified_gmt":"2025-08-03T05:46:56","slug":"how-can-python-read-an-excel-file-and-manipulate-the-data","status":"publish","type":"post","link":"https:\/\/www.silicloud.com\/blog\/how-can-python-read-an-excel-file-and-manipulate-the-data\/","title":{"rendered":"Python Excel Data Manipulation with Pandas"},"content":{"rendered":"<p>To read an Excel file and process data, you can use the pandas library in Python. Here is a simple example code to read an Excel file, process the data, and save the processed data to a new Excel file:<\/p>\n<pre class=\"post-pre\"><code><span class=\"hljs-keyword\">import<\/span> pandas <span class=\"hljs-keyword\">as<\/span> pd\r\n\r\n<span class=\"hljs-comment\"># \u8bfb\u53d6Excel\u6587\u4ef6<\/span>\r\ndf = pd.read_excel(<span class=\"hljs-string\">'data.xlsx'<\/span>)\r\n\r\n<span class=\"hljs-comment\"># \u5904\u7406\u6570\u636e<\/span>\r\ndf[<span class=\"hljs-string\">'new_column'<\/span>] = df[<span class=\"hljs-string\">'column1'<\/span>] + df[<span class=\"hljs-string\">'column2'<\/span>]\r\n\r\n<span class=\"hljs-comment\"># \u4fdd\u5b58\u5904\u7406\u540e\u7684\u6570\u636e\u5230\u65b0\u7684Excel\u6587\u4ef6<\/span>\r\ndf.to_excel(<span class=\"hljs-string\">'processed_data.xlsx'<\/span>, index=<span class=\"hljs-literal\">False<\/span>)\r\n<\/code><\/pre>\n<p>In this example, we start by using the pd.read_excel() function to read an Excel file named data.xlsx and store the data in a DataFrame called df. Next, we create a new column called new_column while processing the data, which is the sum of columns column1 and column2. Finally, we use the to_excel() function to save the processed data to a new Excel file named processed_data.xlsx, with the index=False parameter indicating that the row index should not be saved.<\/p>\n<p>By using the pandas library, Python can effortlessly read and manipulate data from Excel files, making data processing easier and more efficient.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>To read an Excel file and process data, you can use the pandas library in Python. Here is a simple example code to read an Excel file, process the data, and save the processed data to a new Excel file: import pandas as pd # \u8bfb\u53d6Excel\u6587\u4ef6 df = pd.read_excel(&#8216;data.xlsx&#8217;) # \u5904\u7406\u6570\u636e df[&#8216;new_column&#8217;] = df[&#8216;column1&#8217;] + [&hellip;]<\/p>\n","protected":false},"author":6,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_import_markdown_pro_load_document_selector":0,"_import_markdown_pro_submit_text_textarea":"","footnotes":""},"categories":[1],"tags":[410,342,558,1094,72],"class_list":["post-8496","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-data-manipulation","tag-data-processing","tag-excel","tag-pandas","tag-python"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v21.5 (Yoast SEO v21.5) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Python Excel Data Manipulation with Pandas - Blog - Silicon Cloud<\/title>\n<meta name=\"description\" content=\"Learn to read Excel files and manipulate data in Python using pandas. Simple code example included.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.silicloud.com\/blog\/how-can-python-read-an-excel-file-and-manipulate-the-data\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Python Excel Data Manipulation with Pandas\" \/>\n<meta property=\"og:description\" content=\"Learn to read Excel files and manipulate data in Python using pandas. Simple code example included.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.silicloud.com\/blog\/how-can-python-read-an-excel-file-and-manipulate-the-data\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog - Silicon Cloud\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/SiliCloudGlobal\/\" \/>\n<meta property=\"article:published_time\" content=\"2024-03-14T08:12:36+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-08-03T05:46:56+00:00\" \/>\n<meta name=\"author\" content=\"Benjamin Taylor\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@SiliCloudGlobal\" \/>\n<meta name=\"twitter:site\" content=\"@SiliCloudGlobal\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Benjamin Taylor\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.silicloud.com\/blog\/how-can-python-read-an-excel-file-and-manipulate-the-data\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.silicloud.com\/blog\/how-can-python-read-an-excel-file-and-manipulate-the-data\/\"},\"author\":{\"name\":\"Benjamin Taylor\",\"@id\":\"https:\/\/www.silicloud.com\/blog\/#\/schema\/person\/ac801fe9549a25960ce48aa2e0a691c9\"},\"headline\":\"Python Excel Data Manipulation with Pandas\",\"datePublished\":\"2024-03-14T08:12:36+00:00\",\"dateModified\":\"2025-08-03T05:46:56+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.silicloud.com\/blog\/how-can-python-read-an-excel-file-and-manipulate-the-data\/\"},\"wordCount\":154,\"publisher\":{\"@id\":\"https:\/\/www.silicloud.com\/blog\/#organization\"},\"keywords\":[\"data manipulation\",\"Data Processing\",\"Excel\",\"pandas\",\"Python\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.silicloud.com\/blog\/how-can-python-read-an-excel-file-and-manipulate-the-data\/\",\"url\":\"https:\/\/www.silicloud.com\/blog\/how-can-python-read-an-excel-file-and-manipulate-the-data\/\",\"name\":\"Python Excel Data Manipulation with Pandas - Blog - Silicon Cloud\",\"isPartOf\":{\"@id\":\"https:\/\/www.silicloud.com\/blog\/#website\"},\"datePublished\":\"2024-03-14T08:12:36+00:00\",\"dateModified\":\"2025-08-03T05:46:56+00:00\",\"description\":\"Learn to read Excel files and manipulate data in Python using pandas. Simple code example included.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.silicloud.com\/blog\/how-can-python-read-an-excel-file-and-manipulate-the-data\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.silicloud.com\/blog\/how-can-python-read-an-excel-file-and-manipulate-the-data\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.silicloud.com\/blog\/how-can-python-read-an-excel-file-and-manipulate-the-data\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.silicloud.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Python Excel Data Manipulation with Pandas\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.silicloud.com\/blog\/#website\",\"url\":\"https:\/\/www.silicloud.com\/blog\/\",\"name\":\"Silicon Cloud Blog\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/www.silicloud.com\/blog\/#organization\"},\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.silicloud.com\/blog\/#organization\",\"name\":\"Silicon Cloud Blog\",\"url\":\"https:\/\/www.silicloud.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.silicloud.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.silicloud.com\/blog\/wp-content\/uploads\/2023\/11\/EN-SILICON-Full.png\",\"contentUrl\":\"https:\/\/www.silicloud.com\/blog\/wp-content\/uploads\/2023\/11\/EN-SILICON-Full.png\",\"width\":1024,\"height\":1024,\"caption\":\"Silicon Cloud Blog\"},\"image\":{\"@id\":\"https:\/\/www.silicloud.com\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/SiliCloudGlobal\/\",\"https:\/\/twitter.com\/SiliCloudGlobal\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.silicloud.com\/blog\/#\/schema\/person\/ac801fe9549a25960ce48aa2e0a691c9\",\"name\":\"Benjamin Taylor\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.silicloud.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/ec2e3d3e2d525fd148047c4520ae7c1cdccd1f4b48a1a488422b31f04f345c14?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/ec2e3d3e2d525fd148047c4520ae7c1cdccd1f4b48a1a488422b31f04f345c14?s=96&d=mm&r=g\",\"caption\":\"Benjamin Taylor\"},\"url\":\"https:\/\/www.silicloud.com\/blog\/author\/benjamintaylor\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Python Excel Data Manipulation with Pandas - Blog - Silicon Cloud","description":"Learn to read Excel files and manipulate data in Python using pandas. Simple code example included.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.silicloud.com\/blog\/how-can-python-read-an-excel-file-and-manipulate-the-data\/","og_locale":"en_US","og_type":"article","og_title":"Python Excel Data Manipulation with Pandas","og_description":"Learn to read Excel files and manipulate data in Python using pandas. Simple code example included.","og_url":"https:\/\/www.silicloud.com\/blog\/how-can-python-read-an-excel-file-and-manipulate-the-data\/","og_site_name":"Blog - Silicon Cloud","article_publisher":"https:\/\/www.facebook.com\/SiliCloudGlobal\/","article_published_time":"2024-03-14T08:12:36+00:00","article_modified_time":"2025-08-03T05:46:56+00:00","author":"Benjamin Taylor","twitter_card":"summary_large_image","twitter_creator":"@SiliCloudGlobal","twitter_site":"@SiliCloudGlobal","twitter_misc":{"Written by":"Benjamin Taylor","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.silicloud.com\/blog\/how-can-python-read-an-excel-file-and-manipulate-the-data\/#article","isPartOf":{"@id":"https:\/\/www.silicloud.com\/blog\/how-can-python-read-an-excel-file-and-manipulate-the-data\/"},"author":{"name":"Benjamin Taylor","@id":"https:\/\/www.silicloud.com\/blog\/#\/schema\/person\/ac801fe9549a25960ce48aa2e0a691c9"},"headline":"Python Excel Data Manipulation with Pandas","datePublished":"2024-03-14T08:12:36+00:00","dateModified":"2025-08-03T05:46:56+00:00","mainEntityOfPage":{"@id":"https:\/\/www.silicloud.com\/blog\/how-can-python-read-an-excel-file-and-manipulate-the-data\/"},"wordCount":154,"publisher":{"@id":"https:\/\/www.silicloud.com\/blog\/#organization"},"keywords":["data manipulation","Data Processing","Excel","pandas","Python"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.silicloud.com\/blog\/how-can-python-read-an-excel-file-and-manipulate-the-data\/","url":"https:\/\/www.silicloud.com\/blog\/how-can-python-read-an-excel-file-and-manipulate-the-data\/","name":"Python Excel Data Manipulation with Pandas - Blog - Silicon Cloud","isPartOf":{"@id":"https:\/\/www.silicloud.com\/blog\/#website"},"datePublished":"2024-03-14T08:12:36+00:00","dateModified":"2025-08-03T05:46:56+00:00","description":"Learn to read Excel files and manipulate data in Python using pandas. Simple code example included.","breadcrumb":{"@id":"https:\/\/www.silicloud.com\/blog\/how-can-python-read-an-excel-file-and-manipulate-the-data\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.silicloud.com\/blog\/how-can-python-read-an-excel-file-and-manipulate-the-data\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.silicloud.com\/blog\/how-can-python-read-an-excel-file-and-manipulate-the-data\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.silicloud.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Python Excel Data Manipulation with Pandas"}]},{"@type":"WebSite","@id":"https:\/\/www.silicloud.com\/blog\/#website","url":"https:\/\/www.silicloud.com\/blog\/","name":"Silicon Cloud Blog","description":"","publisher":{"@id":"https:\/\/www.silicloud.com\/blog\/#organization"},"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.silicloud.com\/blog\/#organization","name":"Silicon Cloud Blog","url":"https:\/\/www.silicloud.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.silicloud.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.silicloud.com\/blog\/wp-content\/uploads\/2023\/11\/EN-SILICON-Full.png","contentUrl":"https:\/\/www.silicloud.com\/blog\/wp-content\/uploads\/2023\/11\/EN-SILICON-Full.png","width":1024,"height":1024,"caption":"Silicon Cloud Blog"},"image":{"@id":"https:\/\/www.silicloud.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/SiliCloudGlobal\/","https:\/\/twitter.com\/SiliCloudGlobal"]},{"@type":"Person","@id":"https:\/\/www.silicloud.com\/blog\/#\/schema\/person\/ac801fe9549a25960ce48aa2e0a691c9","name":"Benjamin Taylor","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.silicloud.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/ec2e3d3e2d525fd148047c4520ae7c1cdccd1f4b48a1a488422b31f04f345c14?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/ec2e3d3e2d525fd148047c4520ae7c1cdccd1f4b48a1a488422b31f04f345c14?s=96&d=mm&r=g","caption":"Benjamin Taylor"},"url":"https:\/\/www.silicloud.com\/blog\/author\/benjamintaylor\/"}]}},"_links":{"self":[{"href":"https:\/\/www.silicloud.com\/blog\/wp-json\/wp\/v2\/posts\/8496","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.silicloud.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.silicloud.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/blog\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/blog\/wp-json\/wp\/v2\/comments?post=8496"}],"version-history":[{"count":2,"href":"https:\/\/www.silicloud.com\/blog\/wp-json\/wp\/v2\/posts\/8496\/revisions"}],"predecessor-version":[{"id":153312,"href":"https:\/\/www.silicloud.com\/blog\/wp-json\/wp\/v2\/posts\/8496\/revisions\/153312"}],"wp:attachment":[{"href":"https:\/\/www.silicloud.com\/blog\/wp-json\/wp\/v2\/media?parent=8496"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.silicloud.com\/blog\/wp-json\/wp\/v2\/categories?post=8496"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.silicloud.com\/blog\/wp-json\/wp\/v2\/tags?post=8496"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}