Visualizing data from Excel sheet with Filter in NodeRed

Hi
iam looking for a way to exctract/visualize data from a excel sheet or CSV

Aim:
We have a booking system that wir export a CSV/Excel file very 30min. with new or change bookings.

I want to display the current booking Attandee (i.e the booking @1pm) on a Dashboard next to the Booked activity

For Example
City Tour New York - Andy Smith

I havent figured out how to filter the "raw" csv to just extract the name next to the activtiy and also to just display the next attandee based on the system time.

Anyone a suggestion on how to get startet or even resolve this eaiser than i thought?

Thanks

I would start by using a csv node to convert the data to javascript objects.

Hi Colin

How do you convert it to js objects ?

There are various libraries that can help with this if you really need to use an Excel workbook as the source. Generally, CSV files are easier to work with outside a spreadsheet as in this case but there are libraries that will work direct with Excel workbooks too.

Node-RED isn't brilliant at doing streamed interfaces which means that you need to read in the whole file first, use the CSV node to convert the input to JSON and then you can filter using standard JavaScript.

After conversion, you should end up with a msg.payload that contains an array of objects. Each input record becomes an array element and each column of each record is an object with named (assuming your input CSV has column names) properties.

msg.payload = [
  {
    "col1": 1,
    "col2": 2,
  },
  {
    "col1": 3,
    "col2": 4,
  }
]

From this you can use the Array.filter function to create a shallow copy of the input filtered to only the records you need.

Array.prototype.filter() - JavaScript | MDN (mozilla.org)

1 Like

Start by reading the help text for the csv node.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.