After browsing a file I have to check if a csv file contains a formula or not in typescript or javascript. Please help with an npm module or a function, as I need to protect a file from CSV Injection before uploading a file. The below code is what I have tried so far, it is just giving me the string-like #VALUE!, #NAME!, etc. instead I want =B1+C1
var files = e.target.files;
var file = files[0];
if(file) {
var reader = new FileReader();
reader.readAsText(file);
reader.onload = (event: any) => {
var csv = event.target.result;
var string = <string>csv ;
if(string.replace(/\s+/, "").includes(',-') == true) {
this.service.openSnackBar('PLEASE UPLOAD A VALID FILE','');
} else if (string.includes("+") == true || string.includes("=") == true) {
this.service.openSnackBar('PLEASE UPLOAD A VALID FILE','');
e.target.value = '';
} else {
// if valid upload to server
}
}
}