Hi @scharfh, thanks for the compliment. I’m glad you like it.
Off the bat I think it might have something to do with the extension. I think it’s supposed to be .xlsx. Could you maybe try to edit gf-entries-in-excel/src/Renderer/PHPExcelRenderer.php on line 56, and change .xls to .xlsx and try again?
If that works, I will force the new extension in the next version. Maybe correct it with a toggle or something to switch between both. The file is actually rendered as an XLSX since we’ve updatet the plugin to use phpspeadsheet. But it can render both. Never had a problem with it, so I didn’t know that was wrong π
Please let me know if this helps. If not, I have another idea. But let’s try this first.
Whoa! That was an express reply. Well I did what you have written above, but unfortunately that did not work. I personally think there is no issue with excel extension(s), because if I download file(s) from that link and upload manually all of them work with no problems.
Stefan
Hi @scharfh, So i figured it out. The problem is not on my side, Thankfully! The Wp-import-all plugin only tries to verify the excel output by extension, and because our url doesn’t have an extension, it can’t figure it out.
But I can still fix it for you. I’m willing to make an adjustment to the plugin so you can use it by adding .xls or .xlsx to the end of the file.
in src/GFExcel.php change this:
private function getFormIdByHash($hash)
{
global $wpdb;
//add the following line
$hash = preg_replace("/\.xlsx?$/is", "", $hash);
//.. rest of the file here
Then simply add .xls to the url you’ve entered. Should work like advertised. Let me know if this helps.
Unfortunately that also did not work. Maybe I have figured out why this does not work, I confirm – your plugin has no flaws – but I think that WPall Import need to read file before your URL executes. Eg.: If xls is stored at example.com/wp-content/uploads/2018/excel/gfexcel-file.xls it is loaded correctly…
So, I have tried execute this PHP with cron, well I have not such PHP skills, but file was not saved to desired path:
$source = "https://www.example.com/gf-entries-in-excel/4284abcc13dce9769d541c163078dfabf2940dfdf818482e22c2aad055491326";
$destination = "/opt/bitnami/apps/wordpress/htdocs/wp-content/uploads/2018/export/";
$data = file_get_contents($source);
$file = fopen($destination, "w+");
fputs($file, $data);
fclose($file);
I assume that there is no option for your plugin to save file locally to path. Right?
Stefan
-
This reply was modified 7 years, 11 months ago by
scharfh.
Hi Stefan,
Your script only doesn’t work, because the destination needs to be a filename. So it should end with something like file.xls. I’ve tried that, and I get the file contents perfectly like this.
<?php
$source = "http://url.test/gf-entries-in-excel/slug.xlsx";
$data = file_get_contents($source);
$file = fopen(__DIR__."/file.xls", "w+");
fputs($file, $data);
fclose($file);
also, the wp-all-import plugin also downloads the file before processing. So if you can upload a file and it works, than the url should also work without problems, so I don’t think it’s a right problem.
Can you confirm you can download the file now with the same url with .xls appended? so for example: https://www.example.com/gf-entries-in-excel/yourid.xls ? if that works, than that should be the url in wp-import-all. I’ve got that working on version 4.3.0 of that plugin. I don’t have a newer one, and can’t get one π
-
This reply was modified 7 years, 11 months ago by
Doeke Norg.
OH, I need to admit – I am dumb, DUMB as old oak!
Everything works now – I have forgot to disable maintenance plugin, that was causing all that issue! It is working as a charm!
Thank you so so much for your help, your plugin will truly help on site!
Stefan
Nah, that’s not the first thing that would come to mind! I’ve recently ‘debugged’ something for more than an hour, which wasn’t even a bug. So, dumb is relative π
Not sure now if it was all of the problem, or part of the problem? But for sure the .xls was needed for version 4.3.0 π
Closing the issue now.