Skip to content

Instantly share code, notes, and snippets.

@jtuttas
Last active February 20, 2021 16:15
Show Gist options
  • Save jtuttas/013fb27b6921f3548cbc5dfa71ea53de to your computer and use it in GitHub Desktop.
Save jtuttas/013fb27b6921f3548cbc5dfa71ea53de to your computer and use it in GitHub Desktop.
O365Excel2SQLite

Import an Excel Sheet from O365, convert it to csv and Import the data into an sqlite Database!

Invoke-WebRequest -Uri "https://multimediabbshannover-my.sharepoint.com/:x:/g/personal/tuttas_mmbbs_de/EUB9Zr7V_m5AkO-JdwTnu-8BF3W4l5OIZ8-KccOz_vno6w?download=1" -OutFile "$env:TEMP/test.xlsx"
import-excel "$env:TEMP/test.xlsx" | ConvertTo-Csv -NoTypeInformation | % {$_ -replace '"',''} | Select-Object -Skip 1 | Set-Content "$env:TEMP/test.csv"
C:\Users\jtutt\ownCloud\bin\SQLite\sqlite3.exe C:\Users\jtutt\Downloads\test.db 'delete from test'
$file = "$env:TEMP\test.csv"
$file=$file.Replace("\","\\")
$params = @"
.mode csv
.separator ,
.import $file test
"@
$params | C:\Users\jtutt\ownCloud\bin\SQLite\sqlite3.exe C:\Users\jtutt\Downloads\test.db
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment