Topic
5 replies Latest Post - ‏2012-08-30T11:41:45Z by SystemAdmin
SystemAdmin
SystemAdmin
648 Posts
ACCEPTED ANSWER

Pinned topic newDelimParser versus ExcelParser, csv versus xls

‏2012-08-29T18:41:54Z |
Hi All,

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,

Regards,
Han van den Heuvel
Jibes BV
Updated on 2012-08-30T11:41:45Z at 2012-08-30T11:41:45Z by SystemAdmin
  • SystemAdmin
    SystemAdmin
    648 Posts
    ACCEPTED ANSWER

    Re: newDelimParser versus ExcelParser, csv versus xls

    ‏2012-08-30T04:34:44Z  in response to SystemAdmin
    Hi!

    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()

    Regards,
    Alexander
    • SystemAdmin
      SystemAdmin
      648 Posts
      ACCEPTED ANSWER

      Re: newDelimParser versus ExcelParser, csv versus xls

      ‏2012-08-30T11:06:03Z  in response to SystemAdmin
      Thank 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.

      Regards,
      Han
      • SystemAdmin
        SystemAdmin
        648 Posts
        ACCEPTED ANSWER

        Re: newDelimParser versus ExcelParser, csv versus xls

        ‏2012-08-30T11:12:06Z  in response to SystemAdmin
        Han,

        You don't need to know a filename of an excel file in the import script for opening the file.
        
        var book = 
        
        new ExcelBook();
        
        is working fine
        • SystemAdmin
          SystemAdmin
          648 Posts
          ACCEPTED ANSWER

          Re: newDelimParser versus ExcelParser, csv versus xls

          ‏2012-08-30T11:35:22Z  in response to SystemAdmin
          You 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.

          regards,
          Han van den Heuvel