' 2020-08-11 ' Link to Excel ' Opens a specified WorkBook File ' Imports a specified WorkSheet to a SQLite table ' Optionally will pass over "n" leadings lines of the WorkSheet before importing ' Does NOT change the used WorkBook file function xlReadFile ( FileName , sheetName, tableName , optional DeleteLineCount = 0 ) if ( dbOpen ) then sql = " drop table if exists \"" & tableName & "\"" Else dbOpen ("memory") End If xlstart exl.EnableEvents = False exl.DisplayAlerts=0 exl.Application.DisplayAlerts = 0 ' 2nd Parameter = 0 prevents link update popup window exl.workbooks.open ( filename , 0) ' get the wanted SHEET, ensure it is not hidden (otherwise it is inaccessible!) exl.Worksheets(sheetName).visible=1 exl.Worksheets(sheetName).select ' WARNING: if active sheet has an AutoFilter running then it affects some commands, turn the filter off If exl.ActiveSheet.FilterMode Then exl.ActiveSheet.ShowAllData End If Exl.cells.clearformats exl.DisplayAlerts=0 if ( DeleteLineCount ) then exl.range("A1:" & xlrange (DeleteLineCount,1) ).EntireRow.delete END IF xlcreate ( , tableName) xlreadappend (, tableName) xlclose exl.Application.DisplayAlerts = 1 end function