Open excel file with notepad

Hi, does anyone know why this happen when i tried to open excel file that i have been downloading using PHPExcel library?
Any idea on how to fix this?
I want to open this excel file with notepad, don’t want to open the excel file and save it as .txt file.

Thank you

error5

i want the data to display like this in notepad.
good

why do you think you can open any excel file in notepad and let it look like tabular data? you have given a compressed xml and expect a CSV.

any idea how i can do like what i want to do even not use the PHPExcel library?

if you expect a CSV you can create a CSV

https://www.php.net/manual/en/function.fputcsv.php

if i change the file extension to .xls it will be not same right csv right? Any solution to that or fputcsv is specifically for csv only? Sorry, im newbie in this field. Thanks

if you change the file extension nothing happens. you can build up every format you want with string concatenation and writing that to a file with file_put_contents

Hi,
I did change the extension from csv to xls using fputcsv but the all the data was in one column as in the image not like one value per column
error6

i don’t see you using notepad there

yeah but i still want to download database into excel. and from that excel i just want to open using notepad.

I tried another method which display table in excel but when i open with notepad, i become like this
table2

so think it might have a way to have tabular data like i want. But i don’t know how to do it

you know Nabila, I would bet anything that you can’t do what you want to do without writing VBA code in your excel file and using I/O from visual basic. I would bet 99% that the following resources are as close as you’re going to get without resorting to code writing:

I could be wrong though…PHP has many many resources, as does Python and .NET. but then again, have you seen questions like this???

https://social.msdn.microsoft.com/Forums/sqlserver/en-US/cb09ecbf-90b8-47f9-abe7-8cda9cf733ab/why-are-columns-not-aligned-when-createing-txt-file

What do you want now? Having a format Excel can read? => XLS. Want some fixed space plain text to view it in Notepad? => CSV. You can’t expect to have the same result in Excel and Notepad for the same file. MAYBE when using CSV with semicolon as delimiter, but that’s way off perfect.

Well, okay thanks for the advices vba_php and chorn :smile:

why not try the link I posted? that pretty much spells out what you want to do…

Closest you can get with wordpad is if you first unzip the XLS file. Then you may find “readable” stuff.
You may need to rename it to .zip first.

Sponsor our Newsletter | Privacy Policy | Terms of Service