I have been using csv imports for quiet some time now and barely run into problems.
Creating an import job, webupload a csv file (delimiter = pipe "|"), and i can create a nice parser from it (newDelimParser(in, "|");
But now I run into problems. I got an .xlsx file and export it to a csv file. 64 columns and 4500 rows, so the size is also less then I dealt with before. Somehow the script quits after 37 lines (also when I remove some lines it goes wrong on the next 37th line) and it just reads half of the lines from the CSV file.
So i went from that parser to parse the excel file itself. But from my understanding I can not use the import script with the upload functionality. I have to upload the excel file myself, then run the script (sandbox, import or report, does not matter since the name of the file will be in the script). So my questions basically are:
1) Did anyone ever run into issues with the csv import? Cutting of lines, or not seeing end of lines.
2) Can I use the import functionality for excelfile like : var ebGlobalProductCatalog = new ExcelBook(in); ? Guess not since the function expects a doc from DocStore
3) Is there a way to get the name of the file that is put into the upload field for an import job?
Thank you for reading and answering,
Han van den Heuvel
This topic has been locked.
5 replies Latest Post - 2012-08-30T11:41:45Z by SystemAdmin
Pinned topic newDelimParser versus ExcelParser, csv versus xls
Answered question This question has been answered.
Unanswered question This question has not been answered yet.
Updated on 2012-08-30T11:41:45Z at 2012-08-30T11:41:45Z by SystemAdmin
Re: newDelimParser versus ExcelParser, csv versus xls2012-08-30T04:34:44Z in response to SystemAdminHi!
Why are you using pipe "|" delimiter instead "," for your data? CSV format is a powerful and I have not met problem with a parsing of csv files.
2) You can import from an excel file (but Excel 2003 format is supported only). You can miss the ExcelBook parameter for the import job or when you create a new excel file.
3) I don't remember exactly but there should be an implicit variable $doc. You can check it calling function dumpContext()
Re: newDelimParser versus ExcelParser, csv versus xls2012-08-30T11:06:03Z in response to SystemAdminThank you Alexander,
I am now using a normal import with an excell file and the variable 'feed_doc_path' has the path to the document.
So now i can create an excell parser from an import.
Re: newDelimParser versus ExcelParser, csv versus xls2012-08-30T11:35:22Z in response to SystemAdminYou are absolutely right.
Sometimes I hate it when the plugin does not tell me that and I should read the manual better.
Quote from the manual:
new ExcelBook(Doc docToRead)
When the script op is used within an import job, then an existing ExcelBook is read from the docstore (the default import document or the one that is specified in the docToRead parameter).
so the docToRead is optional.
Thank you again, made my script again 2 lines shorter.
Han van den Heuvel