Search code examples
sql-servert-sqlxlsx

How can I update XLSX sheet through SQL?


I have a connection from SQL (via Linked server) to my XLSx file.

It works just fine if I use XLS file just for reading purpose (select * ...).

But is it possible to update XLS sheet from a SQL? And how?

This is my case:

<https://www.screencast.com/t/M39Nu3dxuCIF>

Thank you for your help!


Solution

  • I have come across with that problem previously. I have fixed it using OPENROWSET()

    Here is sample :

    UPDATE OPENROWSET('Microsoft.Ace.OLEDB.12.0',
     'Excel 12.0;DATABASE=<Your File Location\<your file name>.xls>',
     'SELECT * from [KATALOGSIHR$] ')
     SET KatalogSI=2
     WHERE SAP='18864'