csv export with symbol # as content ends the exportHow to output MySQL query results in CSV format?Response Content type as CSVDealing with commas in a CSV fileSave PL/pgSQL output from PostgreSQL to a CSV fileExcel to CSV with UTF8 encodingmodule.exports vs exports in Node.jsPHP to CSV output to downloadHow to export JavaScript array info to csv (on client side)?Export a csv that can be edited with multi byte charactersjavascript excellent export b64 to blob wont work
How to gently end involvement with an online community?
How do I get toddlers to stop asking for food every hour?
How do I, an introvert, communicate to my friend and only colleague, an extrovert, that I want to spend my scheduled breaks without them?
How long do you think advanced cybernetic implants would plausibly last?
Showing that the limit of non-eigenvector goes to infinity
Is for(( ... )) ... ; a valid shell syntax? In which shells?
What is the best type of paint to paint a shipping container?
Network helper class with retry logic on failure
Disambiguation of "nobis vobis" and "nobis nobis"
How do the Etherealness and Banishment spells interact?
Notepad++ cannot print
Was it ever possible to target a zone?
How do proponents of Sola Scriptura address the ministry of those Apostles who authored no parts of Scripture?
Can I get temporary health insurance while moving to the US?
Two questions about typesetting a Roman missal
Round towards zero
Why did Khan ask Admiral James T. Kirk about Project Genesis?
Asymmetric table
pgfplots: Missing one group of bars
Improving Performance of an XY Monte Carlo
Would it be possible to have a GMO that produces chocolate?
What setting causes my autoindent to add indent on a new line?
How many String objects would be created when concatenating multiple Strings?
Why doesn't 'd /= d' throw a division by zero exception?
csv export with symbol # as content ends the export
How to output MySQL query results in CSV format?Response Content type as CSVDealing with commas in a CSV fileSave PL/pgSQL output from PostgreSQL to a CSV fileExcel to CSV with UTF8 encodingmodule.exports vs exports in Node.jsPHP to CSV output to downloadHow to export JavaScript array info to csv (on client side)?Export a csv that can be edited with multi byte charactersjavascript excellent export b64 to blob wont work
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I have successfully exported my data as csv which worked great until there is a #
character which messed up the exporting. It stopped the exporting anything after #
. When I open the file, I can see that it's giving a newline then stopped.
I already added quotations to the text fields because of the need to export symbols such as ,
which works fine.
Can someone give me suggestions of why meeting #
would give such reaction and way to solve it?
removing #
is the least option to think of, would really prefer to keep the #
I tried replacing #
as ascii u0023
which gives me no luck
How I get the text
const getDiv = bodyCellLabelClass.querySelectorAll('div');
const innerTxt = getDiv[ 0 ].innerText;
result.push(`"$innerTxt"`);
sample of result
would look like if I console.log
[""$41.67"", ""9/9/2018"", ""10/9/2018"", ""9/9/2018"", ""#111"", ""3/11/2019""]
[""$41.67"", ""9/9/2018"", ""10/9/2018"", ""9/9/2018"", ""3"", ""3/11/2019""]
but when I open the csv it'll look like
$41.67, 9/9/2018, 10/9/2018, 9/9/2018, '↵'
nothing after
this is how the export csv looks like
export class ExportUtil
// export file, default excel
public static spreadsheet( rows, full_filename = 'test.xls' ): any
let content = `data:application/vnd.ms-excel;charset=utf-8;`;
rows.forEach(function ( rowArray )
const row = rowArray.join(',');
content += row + 'rn';
);
console.log(content, 'inside spreadsheet content');
const encodedUri = encodeURI(content);
const link = document.createElement('a');
link.setAttribute('href', encodedUri);
link.setAttribute('download', `$full_filename`);
document.body.appendChild(link); // Required for FF
link.click(); // This will download the data file named "my_data.csv".
Thanks in advance for any help and suggestions.
javascript csv unicode ascii export-to-csv
add a comment |
I have successfully exported my data as csv which worked great until there is a #
character which messed up the exporting. It stopped the exporting anything after #
. When I open the file, I can see that it's giving a newline then stopped.
I already added quotations to the text fields because of the need to export symbols such as ,
which works fine.
Can someone give me suggestions of why meeting #
would give such reaction and way to solve it?
removing #
is the least option to think of, would really prefer to keep the #
I tried replacing #
as ascii u0023
which gives me no luck
How I get the text
const getDiv = bodyCellLabelClass.querySelectorAll('div');
const innerTxt = getDiv[ 0 ].innerText;
result.push(`"$innerTxt"`);
sample of result
would look like if I console.log
[""$41.67"", ""9/9/2018"", ""10/9/2018"", ""9/9/2018"", ""#111"", ""3/11/2019""]
[""$41.67"", ""9/9/2018"", ""10/9/2018"", ""9/9/2018"", ""3"", ""3/11/2019""]
but when I open the csv it'll look like
$41.67, 9/9/2018, 10/9/2018, 9/9/2018, '↵'
nothing after
this is how the export csv looks like
export class ExportUtil
// export file, default excel
public static spreadsheet( rows, full_filename = 'test.xls' ): any
let content = `data:application/vnd.ms-excel;charset=utf-8;`;
rows.forEach(function ( rowArray )
const row = rowArray.join(',');
content += row + 'rn';
);
console.log(content, 'inside spreadsheet content');
const encodedUri = encodeURI(content);
const link = document.createElement('a');
link.setAttribute('href', encodedUri);
link.setAttribute('download', `$full_filename`);
document.body.appendChild(link); // Required for FF
link.click(); // This will download the data file named "my_data.csv".
Thanks in advance for any help and suggestions.
javascript csv unicode ascii export-to-csv
Please provide the minimal CSV and code that allows to reproduce your issue
– Nino Filiu
Mar 27 at 18:59
@NinoFiliu my bad, added
– Tsuna
Mar 27 at 19:08
add a comment |
I have successfully exported my data as csv which worked great until there is a #
character which messed up the exporting. It stopped the exporting anything after #
. When I open the file, I can see that it's giving a newline then stopped.
I already added quotations to the text fields because of the need to export symbols such as ,
which works fine.
Can someone give me suggestions of why meeting #
would give such reaction and way to solve it?
removing #
is the least option to think of, would really prefer to keep the #
I tried replacing #
as ascii u0023
which gives me no luck
How I get the text
const getDiv = bodyCellLabelClass.querySelectorAll('div');
const innerTxt = getDiv[ 0 ].innerText;
result.push(`"$innerTxt"`);
sample of result
would look like if I console.log
[""$41.67"", ""9/9/2018"", ""10/9/2018"", ""9/9/2018"", ""#111"", ""3/11/2019""]
[""$41.67"", ""9/9/2018"", ""10/9/2018"", ""9/9/2018"", ""3"", ""3/11/2019""]
but when I open the csv it'll look like
$41.67, 9/9/2018, 10/9/2018, 9/9/2018, '↵'
nothing after
this is how the export csv looks like
export class ExportUtil
// export file, default excel
public static spreadsheet( rows, full_filename = 'test.xls' ): any
let content = `data:application/vnd.ms-excel;charset=utf-8;`;
rows.forEach(function ( rowArray )
const row = rowArray.join(',');
content += row + 'rn';
);
console.log(content, 'inside spreadsheet content');
const encodedUri = encodeURI(content);
const link = document.createElement('a');
link.setAttribute('href', encodedUri);
link.setAttribute('download', `$full_filename`);
document.body.appendChild(link); // Required for FF
link.click(); // This will download the data file named "my_data.csv".
Thanks in advance for any help and suggestions.
javascript csv unicode ascii export-to-csv
I have successfully exported my data as csv which worked great until there is a #
character which messed up the exporting. It stopped the exporting anything after #
. When I open the file, I can see that it's giving a newline then stopped.
I already added quotations to the text fields because of the need to export symbols such as ,
which works fine.
Can someone give me suggestions of why meeting #
would give such reaction and way to solve it?
removing #
is the least option to think of, would really prefer to keep the #
I tried replacing #
as ascii u0023
which gives me no luck
How I get the text
const getDiv = bodyCellLabelClass.querySelectorAll('div');
const innerTxt = getDiv[ 0 ].innerText;
result.push(`"$innerTxt"`);
sample of result
would look like if I console.log
[""$41.67"", ""9/9/2018"", ""10/9/2018"", ""9/9/2018"", ""#111"", ""3/11/2019""]
[""$41.67"", ""9/9/2018"", ""10/9/2018"", ""9/9/2018"", ""3"", ""3/11/2019""]
but when I open the csv it'll look like
$41.67, 9/9/2018, 10/9/2018, 9/9/2018, '↵'
nothing after
this is how the export csv looks like
export class ExportUtil
// export file, default excel
public static spreadsheet( rows, full_filename = 'test.xls' ): any
let content = `data:application/vnd.ms-excel;charset=utf-8;`;
rows.forEach(function ( rowArray )
const row = rowArray.join(',');
content += row + 'rn';
);
console.log(content, 'inside spreadsheet content');
const encodedUri = encodeURI(content);
const link = document.createElement('a');
link.setAttribute('href', encodedUri);
link.setAttribute('download', `$full_filename`);
document.body.appendChild(link); // Required for FF
link.click(); // This will download the data file named "my_data.csv".
Thanks in advance for any help and suggestions.
javascript csv unicode ascii export-to-csv
javascript csv unicode ascii export-to-csv
edited Mar 27 at 19:07
Tsuna
asked Mar 27 at 18:23
TsunaTsuna
7271 gold badge10 silver badges24 bronze badges
7271 gold badge10 silver badges24 bronze badges
Please provide the minimal CSV and code that allows to reproduce your issue
– Nino Filiu
Mar 27 at 18:59
@NinoFiliu my bad, added
– Tsuna
Mar 27 at 19:08
add a comment |
Please provide the minimal CSV and code that allows to reproduce your issue
– Nino Filiu
Mar 27 at 18:59
@NinoFiliu my bad, added
– Tsuna
Mar 27 at 19:08
Please provide the minimal CSV and code that allows to reproduce your issue
– Nino Filiu
Mar 27 at 18:59
Please provide the minimal CSV and code that allows to reproduce your issue
– Nino Filiu
Mar 27 at 18:59
@NinoFiliu my bad, added
– Tsuna
Mar 27 at 19:08
@NinoFiliu my bad, added
– Tsuna
Mar 27 at 19:08
add a comment |
1 Answer
1
active
oldest
votes
try using Blob
export class ExportUtil
// export file, default excel
public static spreadsheet( rows, full_filename = 'test.xls' ): any
let content = '';
rows.forEach(function ( rowArray )
const row = rowArray.join(',');
content += row + 'rn';
);
console.log(content, 'inside spreadsheet content');
const blob = new Blob([ content ], type: 'application/vnd.ms-excel;charset=utf-8;' );
const url = URL.createObjectURL(blob);
const link = document.createElement('a');
link.setAttribute('href', url);
link.setAttribute('download', `$full_filename`);
document.body.appendChild(link); // Required for FF
link.click(); // This will download the data file named "my_data.csv".
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55384151%2fcsv-export-with-symbol-as-content-ends-the-export%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
try using Blob
export class ExportUtil
// export file, default excel
public static spreadsheet( rows, full_filename = 'test.xls' ): any
let content = '';
rows.forEach(function ( rowArray )
const row = rowArray.join(',');
content += row + 'rn';
);
console.log(content, 'inside spreadsheet content');
const blob = new Blob([ content ], type: 'application/vnd.ms-excel;charset=utf-8;' );
const url = URL.createObjectURL(blob);
const link = document.createElement('a');
link.setAttribute('href', url);
link.setAttribute('download', `$full_filename`);
document.body.appendChild(link); // Required for FF
link.click(); // This will download the data file named "my_data.csv".
add a comment |
try using Blob
export class ExportUtil
// export file, default excel
public static spreadsheet( rows, full_filename = 'test.xls' ): any
let content = '';
rows.forEach(function ( rowArray )
const row = rowArray.join(',');
content += row + 'rn';
);
console.log(content, 'inside spreadsheet content');
const blob = new Blob([ content ], type: 'application/vnd.ms-excel;charset=utf-8;' );
const url = URL.createObjectURL(blob);
const link = document.createElement('a');
link.setAttribute('href', url);
link.setAttribute('download', `$full_filename`);
document.body.appendChild(link); // Required for FF
link.click(); // This will download the data file named "my_data.csv".
add a comment |
try using Blob
export class ExportUtil
// export file, default excel
public static spreadsheet( rows, full_filename = 'test.xls' ): any
let content = '';
rows.forEach(function ( rowArray )
const row = rowArray.join(',');
content += row + 'rn';
);
console.log(content, 'inside spreadsheet content');
const blob = new Blob([ content ], type: 'application/vnd.ms-excel;charset=utf-8;' );
const url = URL.createObjectURL(blob);
const link = document.createElement('a');
link.setAttribute('href', url);
link.setAttribute('download', `$full_filename`);
document.body.appendChild(link); // Required for FF
link.click(); // This will download the data file named "my_data.csv".
try using Blob
export class ExportUtil
// export file, default excel
public static spreadsheet( rows, full_filename = 'test.xls' ): any
let content = '';
rows.forEach(function ( rowArray )
const row = rowArray.join(',');
content += row + 'rn';
);
console.log(content, 'inside spreadsheet content');
const blob = new Blob([ content ], type: 'application/vnd.ms-excel;charset=utf-8;' );
const url = URL.createObjectURL(blob);
const link = document.createElement('a');
link.setAttribute('href', url);
link.setAttribute('download', `$full_filename`);
document.body.appendChild(link); // Required for FF
link.click(); // This will download the data file named "my_data.csv".
answered Mar 27 at 23:27
DoraDora
2,0717 gold badges26 silver badges56 bronze badges
2,0717 gold badges26 silver badges56 bronze badges
add a comment |
add a comment |
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55384151%2fcsv-export-with-symbol-as-content-ends-the-export%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Please provide the minimal CSV and code that allows to reproduce your issue
– Nino Filiu
Mar 27 at 18:59
@NinoFiliu my bad, added
– Tsuna
Mar 27 at 19:08