2

I am prompting window on desktop to save file on local device by using following code

if (finalResult == '') {
    alert("Invalid data");
    return;
}
var result2 = nameObject.personalInfo[0].Name;
var result3 = nameObject.personalInfo[0].Number;
var fileName = result2 + result3;
var uri = 'data:text/csv;charset=utf-8,' + escape(finalResult);
var link = document.createElement("a");
link.href = uri;
link.style = "visibility:hidden";
link.download = fileName + ".csv";
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
location.reload();

By this user can get CSV into excel. Will same code work for android devices? If not then please suggest me alternatives. Thank you

3
  • stackoverflow.com/a/11338522 Commented Apr 4, 2014 at 5:52
  • @Sreekanthss using JavaScript will it work. Actually I don't have device for testing Commented Apr 4, 2014 at 5:56
  • hope so, try that all the best Commented Apr 4, 2014 at 6:00

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.