0

I can download a CSV file an external link:

www.website.com/csv1 - This would download a csv file.

My website: www.mysite.com

How do I read the contents of the CSV file by accessing it from www.website.com/csv1 from my website. All done on client side.

What I have tried:

window.open(`www.website.com/csv1`, "_blank");

This would just download the csv file to the client side, but I want to be able to parse the contents of the file.

Ayush Parikh
  • 85
  • 1
  • 6
  • Does this answer your question? [HTML - read .txt file from URL location in javascript](https://stackoverflow.com/questions/28828029/html-read-txt-file-from-url-location-in-javascript) – Leon Thierschmidt May 29 '20 at 17:11
  • @LeonThierschmidt kind of but I have to download it via browser, not able to do a GET request through code. Because the website I am accessing requires authentication. – Ayush Parikh May 29 '20 at 17:13
  • Use [axios](https://github.com/axios/axios) to send a GET request. You should be able to specify authentication as described in this answer: [How to send Basic Auth with axios](https://stackoverflow.com/a/44239543/10046076). – Daemon Beast May 29 '20 at 17:22
  • @Zera i don't know the information. The csv file is located on an internal site at my workplace. The website uses the credientials located on my laptop. I don't know what they are. I have to download CSV file by actually visiting the chrome site and downloading it. I was wondering if there is a way to open chrome and download file and parse it via client javascript. – Ayush Parikh May 29 '20 at 17:26

0 Answers0