Save !csvLine to a particular column?

csv

#1

Hello, I just started using Kantu and find it to be a powerful tool. However, I have encountered a problem and couldn’t find a solution to it through searching. Does anyone know how I can save a !csvLine value to a particular column of the csv file? I’m asking because some information categories are not present on all the pages I’m scraping and if Kantu fails to grab that information, it’ll not reserve a place for it in the CSV and the next value it finds will take its place and this will result in columns of information of different categories. So I would like to assign values grabbed from a particular category to a particular column. Is it possible? Hope I made myself clear. Thanks.


#2

and if Kantu fails to grab that information, it’ll not reserve a place for it in the CSV

You can solve this by storing some dummy information in the variable first:

  • store | xxxxx | data
  • storeText | id=… | data
  • store | ${data} | !csvline

Now CSVLine has either the extracted data (if any) or the text “xxxxx”.


#3

Thanks for the reply and for the solution. The walkaround I came up with was to use the If - else - endif commands but obviously your method saves more lines. :slight_smile: