So I’m trying to extract different things from a list of excel files. I need a string from a particular cell, then from the last cell, etc…
So what’s the N8Nian way for this kind of thing: read a file once, and accessing it multiple times and saving bits to Set fields, so we can use them later on?
I was thinking of Read File → Extract 1 → Set field → Extract2 → Set Field-> Extract 3… etc.
This is not working… only the first Extract from File node has access to the binary data. All others complain with the error “This operation expects the node’s input data to contain a binary file ‘data’, but none was found [item 0]”. Even if I use the option “Input Fields to Include”.
I know I can branch out from the initial Read File node, but then I get into the issue of loosing access to each item. That is to say, a Set Field for File #1 is not accessible down the line.
What is the error message (if any)?
This operation expects the node’s input data to contain a binary file ‘data’, but none was found [item 0]
Hey thanks for your pointers. The excel files are not very well structered. There are blocks like a header, and another block that is the table I need to import later on to postgresql.
That’s why I’m trying to read in pieces. A range to get the header, a predefined cell to get an id, and then another range to get a clean table.
I could read the entire file once, and then parse all those things, including the table. But I thought Id just use N8N builtin capabilities of the extract node.
The looping could maybe not be done, but that’s something I can look into later. The issue is how can I refer to the same binary file later in the workflow?
Do you have an example of one of these excel files? Technically you should just read the excel file once and then simply ready the different cells you require
Hey thanks both @darrell_tw and @Wouter_Nigrini . I never considered the aggregate node before. Code Nodes, I try to avoid if possible.
I had something like this, but after the loop when inserting into postgresql I was having trouble getting the set variables from the loop… let’s say using the date in the sql query that sends the table to postgresql.
Let me look into it again. Ill let you know if it worked with the aggregate node.
what if the range for the table depends on a header? So we need to first read a header to define the range for the table, because we have 2 types of excel…
So we do need to 1st extract the type of file from the header, then set the range accordingly, and then re-read the file to get the table from the correct range…