Fix Downloaded Excel File

%3CLINGO-SUB%20id%3D%22lingo-sub-171340%22%20slang%3D%22en-US%22%3EFix%20Downloaded%20Excel%20File%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-171340%22%20slang%3D%22en-US%22%3E%3CP%3EI%20created%20a%20php%20web%20app%20in%20Azure%20that%26nbsp%3Bpulls%20an%20excel%20file%20(xlsx)%20from%20an%20external%20website.%20I%20would%20like%20to%20parse%20it%20and%20insert%20the%20data%20into%20SQL%20server%2C%20but%20the%20file%20can't%20be%20read.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIf%20I%20open%20it%20on%20my%20own%20OS%20in%20excel%2C%20it%20looks%20fine.%20I%20can%20save%20that%20file%20and%20then%20PHP%20or%20Javascript%20can%20parse%20it%20just%20fine.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20file%20size%20jumps%20up%20a%20lot%20from%20the%20first%20file%20to%20the%20saved%20second%20file.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EI%20can't%20figure%20out%20why%20the%20first%20file%20is%20corrupt.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EI%20need%20to%20take%20out%20this%20manual%20step%20and%20find%20an%20automated%20solution%20to%20fix%20the%20xlsx%20file%20using%20my%20Azure%20web%20app%20so%20I%20can%20schedule%20the%20job.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EI%20did%20find%20a%20way%20to%20do%20it%20via%20a%20vbs%20file%20on%20another%20web%20server%20that%20I%20have%20access%20to%20the%20OS.%20It%20runs%20a%26nbsp%3BCreateObject(%22Excel.Application%22)%20command%20that%20basically%20just%20opens%20and%20saves%20the%20file.%20Not%20sure%20that's%20possible%20on%20Azure.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EDoes%20anybody%20have%20any%20ideas%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-171340%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAPI%20Management%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EAzure%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EDeveloper%20Tools%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Visitor

I created a php web app in Azure that pulls an excel file (xlsx) from an external website. I would like to parse it and insert the data into SQL server, but the file can't be read.

 

If I open it on my own OS in excel, it looks fine. I can save that file and then PHP or Javascript can parse it just fine.

 

The file size jumps up a lot from the first file to the saved second file.

 

I can't figure out why the first file is corrupt.

 

I need to take out this manual step and find an automated solution to fix the xlsx file using my Azure web app so I can schedule the job.

 

I did find a way to do it via a vbs file on another web server that I have access to the OS. It runs a CreateObject("Excel.Application") command that basically just opens and saves the file. Not sure that's possible on Azure.

 

Does anybody have any ideas?

0 Replies