
:max_bytes(150000):strip_icc()/openofficeinsertfunction-15c6f11a21704f93bd5b94bdf1cc6379.jpg)
My_cell = ThisComponent.Sheets(i).getCellByPosition(col,row) Typical way of accessing a cell as below. Once we get a handle of a sheet using Sheets(subscript), we can access each individual cells using getCellByPosition method. To access them, we have to use subscript like Sheets(0), Sheets(1) so on. All the sheets is assigned to object my_sheets as an array. Once this is done, the Sheets collection is assigned to my_sheets object to access all the sheets of the workbook. Set my_doc using ThisComponent which refers to the current Calc workbook is open. Sheet1, Sheet2 and Sheet3 contains below data:įirst, we will declare 3 Objects to define the Calc workbook, collection of sheets and a cell. After read, we will show the formatted read contents in a message window. We will read a Calc spreadsheet with 3 sheets, one after another and read the contents of it. In this tutorial, we will demonstrate basic processing of worksheets, cells which is a foundation of many complex macros.

Many times it is required to process those using Macro to automate various tasks. Spreadsheet applications like Calc consists of workbooks, worksheets and individual Cells.
