Dynamic read XLS from URL & append rows before making it available for download
Hello, May be this is not the right platform to raise a question. I need to read a file via a URL like http://abc.com/File.xlsx. This file has some formula fields,Rows would be dynamically added into the read XLS which would be presented to user for download. The formulas should stay intact as they will work when user will fill the data in downloaded XLS. Is this possible using JS XLSX. I learnt about the functions like "sheet_add_json" & to read file as "arraybuffer" but cant figure out how to get headers to write data into it. The file in the URL could be dynamic i.e could have different number of headers at different times. Please guide me.
To read the headers of a worksheet, you can just grab the first row from the AOA conversion:
var range = XLSX.utils.decode_range(ws["!ref"]);
range.e.r = 0;
var first_row = XLSX.utils.sheet_to_json(ws, {range: range, header: 1})[0]