My company receives a daily CDR report from Comcast and I'm trying to get this data into our database in an automated fashion. Unfortunately, Comcast has advised there is a 0% chance they send us a CSV or XLSX or anything that is NOT an XLSM. For some context, Comcast's CDR report is several sheets but I need only the data from Sheet1 (called All CDR) and there are NO macros in sheet1.
So, I have been working all week on a workaround. During testing I was able to get this code to work:
SELECT * FROM OPENROWSET('Microsoft.ACE.OLEDB.12.0', 'Excel 12.0 Macro;
Database=\\\fileserver\Comcast.xlsm;IMEX=1;HDR=YES','select * from [All CDR$]')
NOTE: This only reads the data, I will turn it into an INSERT statement once working.
But I found out that this code ONLY works if the file has been opened and saved. I.e. I had to open the file, enable content, then Excel asks "Do you want to make this file a trusted document?" which I click Yes, then save and exit. Then the code works.
So how can I work around this awful issue courtesy of Comcast? I have Power Automate at my disposal as well as SQL Server and other standard business tools. I have tried using power automate to read the excel file but this has failed as Sharepoint would not recognize the XLSM files, only XLSX. I wanted to use power automate to open the Excel file, save it and close it but I do not think this is possible. Thanks in advance