Skip to main content
March 24, 2021
Question

Read first line of .csv file

  • March 24, 2021
  • 3 replies
  • 0 views

Hi all,

I am using the plugin excel tools to import a csv file to db.

But after that I want to validate the headers just to see if the column names are the same defined in the db.

I tried the function

readexcelsheet(
excelDocument:local!doc,
sheetNumber:0,
startRow:0,
numberOfColumns: 10
) 

But I only got an error saying "evalution error at line ..."

Can someone tell me what I am doing wrong? maybe something regarding data?

Thanks in advance

3 replies

stefanhelzle0001
Brainy
March 24, 2021

Hm ... is this a CSV file or an EXCEL file? I think that readexcelsheet() can only read EXCEL files.

filipevAuthor
March 24, 2021

It is a CSV file.

But if readexcelsheet only works with excel files there is a way to do it with csv files?

stefanhelzle0001
Brainy
March 24, 2021

A CSV file is just text. So you can use readtextfromfile() to do that. Depends a bit on the size of the file. There is a plugin "Text File Function" which allows you to read just a part of the file.

In the end do something in the line of: Read first line, split by separator, check each value in a forEach