a very straightforward task in VBA but am not sure how do I perform in python. Hypothetically if I have an excel called 'excel.xlsm', tab name is 'tabA' and I want to insert a value in cell D15, how do I do that in python?
            Asked
            
        
        
            Active
            
        
            Viewed 6,756 times
        
    0
            
            
        - 
                    This question has a lot of answers if searched on Google. Please do some research before asking on SO community. – Abhay Salvi Apr 20 '20 at 13:36
- 
                    Does this answer your question? [Insert row into Excel spreadsheet using openpyxl in Python](https://stackoverflow.com/questions/17299364/insert-row-into-excel-spreadsheet-using-openpyxl-in-python) – Mayank Porwal Apr 20 '20 at 13:37
- 
                    @Mayank Porwal - thanks mate that was useful as well. – TRex Apr 20 '20 at 14:00
- 
                    1@Abhay salvi - never heard of google, can you send me the link plz! – TRex Apr 20 '20 at 14:01
- 
                    Yeah sure @PrasKam ✌. Try this : https://stackoverflow.com/questions/39805677/write-values-to-a-particular-cell-in-a-sheet-in-pandas-in-python – Abhay Salvi Apr 20 '20 at 14:41
- 
                    1@Abhaysalvi - thanks ! – TRex Apr 20 '20 at 15:50
1 Answers
3
            You need a library called openpyxl for that:
import openpyxl
workbook=openpyxls.load_workbook(path)
worksheet= workbook.get_sheet_by_name('tabA')
worksheet['D15']='Whatever you want to put in D15'
Enjoy and read up on openpyxl for more info.
 
    
    
        Tomfus
        
- 83
- 4
