Note that there are some explanatory texts on larger screens.

plurals
  1. POPython - Working with Excel - Enter data everytime 9 cells at a time
    primarykey
    data
    text
    <p>Hey Guys I am re writing my question with code, First of all I am new to programming. Started to think about programming recently. :( at very later stage of life :)</p> <p>My code is as below:</p> <pre><code> import win32com.client as win32 from win32com.client import Dispatch excel = win32.gencache.EnsureDispatch('Excel.Application') wb = excel.Workbooks.Open(r'F:\python\book1.xlsx') excel.Visible = False ws = wb.Worksheets("Sheet1") # to get the last row used = ws.UsedRange nrows = used.Row + used.Rows.Count ws.Cells(nrows,2).Value = "21" ws.Cells(nrows,2).Offset(2,1).Value = "22" ws.Cells(nrows,2).Offset(3,1).Value = "23" #like this nine values wb.Save() excel.Application.Quit() </code></pre> <p>What I am trying to do is write values in the excel sheet.</p> <p><img src="https://i.stack.imgur.com/uR1UY.jpg" alt="sample sheet"></p> <p><em>Old Question Below Ignore it.</em> I am using Python 2.7 and win32com to access excel file</p> <p>I am stuck with a problem where I need to enter data in to 9 cells each time on column B</p> <p>I want to select the last cell in B column and enter the new set of 9 cell values.</p> <p>I tried to use ws.usedRange but this is not helping as it chooses the last cell wherever the data is present in the whole sheet. You can see in the attached sheet testdata which is spread in columns D,E,F etc so used range chooses the last cell based on that. is there a way to solve my problem? I am ok to use any other module as well if it helps.</p> <p>Thanks.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload