Get Cell Values/Comments from Another Workbook(Offline)

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
Ozgur Emre
Posts: 4
Joined: Mon Nov 05, 2012 9:46 am

Get Cell Values/Comments from Another Workbook(Offline)

Post by Ozgur Emre »

Hello
I have a workbook and it's address is C:\Yetki.ods ; I need some cell comments from this workbook; and I will put these comments to another workbook's cells.
Is there any way to get some cell values/Comments from another workbook without open it?
For example I want to get cell(1,1)'s comment.
I couldn't refer the other book, I don't know how to.

We have formulas but that doesn't bring cell comments.(annotations)
Thank you anyway.
OpenOffice 3.3 on Windows 7
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Get Cell Values/Comments from Another Workbook(Offline)

Post by Villeroy »

[Tutorial] External Links In Calc. Spreadsheets operate on cell values only. All the other elements are illustration and decoration.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
User avatar
einstein
Posts: 47
Joined: Sat Nov 05, 2016 1:45 am
Location: State of Mexico, México.

Re: Get Cell Values/Comments from Another Workbook(Offline)

Post by einstein »

And After using external links then (maybe) we can use a user-defined function.
This function returns the comment of equis cell.
=COMENTARIO("SheetName";"D4")

Code: Select all

Function Comentario(Hoja, celda)
	   oDoc = ThisComponent
	  hojas = oDoc.getSheets()
	 oSheet = hojas.GetByName(hoja)
	  oCell = oSheet.getCellRangeByName(celda)
      oCmt = oCell.getAnnotation()
   oCmtStr = oCmt.getString()
 Comentario = oCmtStr
End Function
lo 5.1.6.2 | aoo 4.1.3 | win 7/10
All I know is that I know nothing
Post Reply