Private Sub LogThreadToSpreadsheet
Dim ThreadID1 As String = "Thread1"
Dim CreatedAs As String = "2024Jan07"
Dim Metadata As String = "whatever.you.want"
Private XL As XLUtils
XL.Initialize
' Define folder and filename
Dim Folder As String = "D:\Downloads" ' Set your folder path here
Dim FileName As String = "ThreadList.xlsx" ' Set your spreadsheet filename here
'Create workbook and worksheet
Dim workbook As XLWorkbookWriter = XL.CreateWriterFromTemplate(Folder, FileName)
Dim sheet1 As XLSheetWriter = workbook.CreateSheetWriterByName("Threads")
' Find the next empty row
Dim RowNum As Int
RowNum = workbook.PoiWorkbook.GetSheetByName("Threads").LastRowNumber + 2
Log("RowNum = " & RowNum)
'Dim Row As PoiRow = workbook.PoiWorkbook.GetSheetByName("Threads").GetRow(RowNum)
Log("Here")
' Write thread details into the new row
sheet1.PutString(XL.AddressOne("A", RowNum), ThreadID1) ' Column A for ID
Log("Here1")
sheet1.PutString(XL.AddressOne("B", RowNum), CreatedAt) ' Column B for Created_At
Log("Here2")
sheet1.PutString(XL.AddressOne("C", RowNum), Metadata) ' Column C for Metadata
Log("Here3")
' Save the workbook
Dim f As String = workbook.SaveAs(Folder, FileName, True)
Wait For (XL.OpenExcel(f)) Complete (Success As Boolean)
End Sub