Oh the value of the column I have put as the id in excel... I assume that's right?
PodioImporter::process_app for xlsx files
I'm getting a bit stuck...
I have the following code:
I have an xlsx file I would like to import data from using your lovely php function you provide.. But i'm really stuck using it.
Let's say I have a column in my excel spreadsheet called "Name" and I want to map all the row values in that column to my application in Podio as new app items.
What do I need to do with the above to stop this coming up: "No importer for files of type application/octet-stream" or is it that you do not allow xlsx files to be imported?
Please sign in to leave a comment.
It's a money value in excel and money field in Podio
Oh yeah, the uploaded file id comes from code called previously before:
$uploadResult = PodioFile::upload( $filePath . $fileNameWithExt, $fileName );
The problem is that we do not know what type of file it is. You should supply the content-type when you upload the file.
Is there another parameter to the $args I should add...? Is there an example bit of code I can use? I have tried:
"content_type" => "application/openxmlformats-officedocument.spreadsheetml.sheet",
I assume I should be embarrassed at my feeble attempt but i'm confused. I do not directly have access to the curl content headers from the Podio API... or..dooo iii?
It could be a good exercise for you to make the needed changes in podio-php to facilitate passing a content-type as an option to PodioFile::upload() that would be passed onto curl. I would be happy to review any pull requests on github :)
I've made a start...
Haven't really looked into your code before, so may take me a while (customer will have to wait on this one :( ). Just a few questions to make sure i'm doing what is expected:
The curl request that the PodioFile::upload uses is the one I need to set the custom header for... from this, you guys assign the file type to the request and return the file id with that info stored behind it.
When using PodioImporter::process_app, you get the information from the file id and realise you do not know what file type it is and thus throw an error?
Does this sound right?
I've added a new section in my own code that adds content-type header to the upload request... I now get this error:
Fatal error: Uncaught PodioBadRequestError: "'utf8' codec can't decode byte 0xfa in position 202: invalid start byte"
I'm not really sure what to do to make this import function work. I think i'll abandon this for now, I've unfortunately got a bit of a tight deadline :)