title: Can I modify specific sheet from Excel file and write back to the same without modifying other sheets using Pandas | openpyxl
body: <p>I'll try to explain my problem with an example:</p>
  
  <p>Let's say I have an Excel file <code>test.xlsx</code> which has five tabs (aka worksheets): Sheet1, Sheet2, Sheet3, Sheet4 and sheet5. I am interested to read and modify data in sheet2.</p>
  
  <p>My sheet2 has some columns whose cells are dropdowns and those dropdown values are defined in sheet4 and sheet5. I don't want to touch sheet4 and sheet5. (I mean sheet4 &amp; sheet5 have some references to cells on Sheet2).</p>
  
  <p>I know that I can read all the sheets in excel file using <code>pd.read_excel('test.xlsx', sheetnames=None)</code> which basically gives all sheets as a dictionary(OrderedDict) of DataFrames.</p>
  
  <p>Now I want to modify my sheet2 and save it without disturbing others. So is it posibble to do this using <strong>Python Pandas library.</strong></p>
  
  <p><strong>[UPDATE - 4/1/2019]</strong></p>
  
  <p>I am using Pandas read_excel to read whatever sheet I need from my excel file, validating the data with the data in database and updating the status column in the excelfile.</p>
  
  <p>So for writing back the status column in excel I am using openpyxl as shown in the below pseudo code.</p>
  
  <pre><code>import pandas as pd
  import openpyxl
  
  df = pd.read_excel(input_file, sheetname=my_sheet_name)
  df = df.where((pd.notnull(df)), None)
  
  write_data = {}
  
  # Doing some validations with the data and building my write_data with key 
  # as (row_number, column_number) and value as actual value to put in that 
  # cell.
  
  at the end my write_data looks something like this: 
  {(2,1): 'Hi', (2,2): 'Hello'}
  </code></pre>
  
  <p>Now I have defined a seperate class named <strong>WriteData</strong> for writing data using openpyxl</p>
  
  <pre><code># WriteData(input_file, sheet_name, write_data)
  
  book = openpyxl.load_workbook(input_file, data_only=True, keep_vba=True)
  sheet = book.get_sheet_by_name(sheet_name)
  
  for k, v in write_data.items():
     row_num, col_num = k
     sheet.cell(row=row_num, column=col_num).value = v
  
  book.save(input_file)
  </code></pre>
  
  <p>Now when I am doing this operation it is removing all the formulas and diagrams. <strong>I am using openpyxl 2.6.2</strong></p>
  
  <p>Please correct me if I am doing anything wrong! Is there any better way to do?</p>
  
  <p>Any help on this will be greatly appreciated :)</p>