Page 1 of 1
[Solved] Receive strings from serial port to spreadsheet via Basic
Posted: Sat Dec 31, 2022 1:21 am
by martg
Does Basic in Openoffice spreadsheet include commands to run something similar to the following test sw. eg. Below.
Specifically is "com1 " supported or is there an equivalent in Openoffice Basic?
as in. "Dim Incoming As String = com1.ReadLine()" eg.Below
( the aim is to import real time data from a usb. port to spreadsheet on PC. )
eg.
Function ReceiveSerialData() As String
' Receive strings from a serial port.
Dim returnStr As String = ""
Dim com1 As IO.Ports.SerialPort = Nothing
Try
com1 = My.Computer.Ports.OpenSerialPort("COM1")
com1.ReadTimeout = 10000
Do
Dim Incoming As String = com1.ReadLine()
If Incoming Is Nothing Then
Exit Do
Else
returnStr &= Incoming & vbCrLf
End If
Loop
Catch ex As TimeoutException
returnStr = "Error: Serial Port read timed out."
Finally
If com1 IsNot Nothing Then com1.Close()
End Try
Re: Receive strings live. from serial port to PC.spreadsheet via Basic
Posted: Sat Dec 31, 2022 11:05 am
by Villeroy
C++, Java, Python, or anything Microsoft has to offer, but not the supplementary StarBasic lingo.
Simply write the data into a text file and handle that with any software able to load text.
Re: Receive strings live. from serial port to PC.spreadsheet via Basic
Posted: Sat Dec 31, 2022 11:17 am
by Zizi64
It worked with the ancient old versions of the OpenOffice.org, but not work with the newer version of the Apache OpenOffice nor LibreOffice:
https://forum.openoffice.org/en/forum/v ... .php?t=682
https://forum.openoffice.org/en/forum/v ... 20&t=31686
Re: Receive strings live. from serial port to PC.spreadsheet via Basic
Posted: Sat Dec 31, 2022 11:51 am
by JeJe
You can declare Windows API functions in OOBasic. If you search for VB6 results for what you want - sometimes little translation is needed - so long as a few things like memory pointers aren't used it should run in OO.
I quickly found this,
http://www.thescarms.com/vbasic/CommIO.aspx
Edit: if you can't get something to work from within OO automation is another option.
Re: Receive strings live. from serial port to PC.spreadsheet via Basic
Posted: Sun Jan 01, 2023 12:41 am
by martg
Thanks folks,
That last link looks promising.JeJe.
Any further suggestions most welcome.
Re: Receive strings live. from serial port to PC.spreadsheet via Basic
Posted: Wed Jul 31, 2024 7:33 am
by Jurassic Pork
Hello,
with python macros , in Openoffice and LibreOffice calc it is possible to acquire data from serial port in real time. Require pyserial package (installed with pip manager of Apso).
it works under Windows and Linux.
Capture shows a calc workbook obtaining RMC dataframes for a serial port GPS every 2 seconds. Python is multi-thread, so you can work in the worksheet while the data are displayed.

- OOSerialPortPython.gif (118.3 KiB) Viewed 6335 times
Friendly, J.P
Re: Receive strings live. from serial port to PC.spreadsheet via Basic
Posted: Fri Mar 07, 2025 4:51 pm
by marcofelixiano
Jurassic Pork wrote: ↑Wed Jul 31, 2024 7:33 am
Hello,
with python macros , in Openoffice and LibreOffice calc it is possible to acquire data from serial port in real time. Require pyserial package (installed with pip manager of Apso).
it works under Windows and Linux.
Capture shows a calc workbook obtaining RMC dataframes for a serial port GPS every 2 seconds. Python is multi-thread, so you can work in the worksheet while the data are displayed.
OOSerialPortPython.gif
Friendly, J.P
Hi, Please can you share the file ?
Thankyou
Re: Receive strings live. from serial port to PC.spreadsheet via Basic
Posted: Sat Mar 08, 2025 9:24 am
by Jurassic Pork
Hello,
marcofelixiano wrote: ↑Fri Mar 07, 2025 4:51 pm
Hi, Please can you share the file ?
File in attachment
Only works with LibreOffice >= 7.1 ( last APSO version requirement).
Don't forget to install the last version of
APSO (the version with pip manager (ex v1.4.4) ) and install
pySerial with the pip manager.
Friendly, J.P