0

I have tried creating simple .xlsx file like the way I would crate .csv file. File has been generated and it works fine in ubuntu. But in windows, the same file cannot be opened it says, invalid file contents or file format. I can create it with Phpexcel library, but is there any way that I can do it without using library just with core php ? Or is it that, I need to do all the code of library itself ?

This is just a query. I don't have any codes to show. Thanks in advance.

  • 2
    As far as I know, there is no built-in php functions/classes to generate and handle xlsx files, but there are lots of libraries that does that. Don't reinvent the square wheel – Cid Jun 12 at 13:06
  • 1
    Without seeing the file you created we can't tell you why it wasn't deemed to be a valid file. But...what's your issue with using a library exactly? Of course you could write your own code to generate files in the XLSX format - it's an open standard with a published spec. Essentially, in very broad terms, it's just a zip format with some XML files inside it. Nothing stopping you writing code to make such a file. But you'd just be going through the same process as the people who wrote those other libraries. Question is, why would you want to? It's a long road even to get basic functionality. – ADyson Jun 12 at 13:26
  • @ADyson Thank you for the response. Since I was developing plugin, it already had large size so I wanted to reduce the size as much as possible, but I found a way around to do that. So I made my mind to use the library. Thanks. – Suz Aann shrestha Jun 12 at 16:43
  • @Cid Thank you for the insights :) – Suz Aann shrestha Jun 12 at 16:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.