I have my SQL output as five columns. When I paste the SQL output to Excel it seems to concatenate everything that is a string into one column until a number appears.
In this case, my first 4 columns are text and Excel they are concatenated to one column. My fifth column is a number and that's in the 2nd column in Excel. My column headers are all concatenated to a single cell.
When I paste to NotePad it looks fine. And even when I paste to a text box inside of Excel it looks fine. But when I go to paste the data from NotePad and the text box I get the same thing.
Does anyone know a solution for this? And is this an Excel or SQL issue?
Somehow the Text to Columns in my Excel settings got switched to comma instead of tab. Go to Data > Text to Columns > choose delimited and then choose tab.
Related
I was trying to copy the output from Snowflake to Excel. For example, there are only 4 rows in Snowflake, but it becomes 5 rows with one additional row when I copied it to Excel or Notepad.
I used trim and replace statement to clean up spaces, but the extra row is still there.
So it "works for me" the SQL come from this Answer
Do you have better words, or a cut down example?
I am currently working with a macro that gathers data (code identifier) from a source with a print screen and pastes it to excel.
Problem is, every time a data point (identifier) is a value with an "E" included, excel interprets as a scientific notation and changes the original value.
Is there a way to make excel set the column in which I have those values to text before pasting, or for it to paste the whole content as text automatically?
Thanks for the help.
I have an Excel file that contains some data that needs loading into my sql script. I have gotten most of it done but I am coming up against a problem due to the spreadsheet. The spreadsheet has data in rows that is implicit from the one above it (see the picture below).
Does anyone have any idea of how I can do this? Links to other pages would be welcome,I just wouldn't know how to start searching for this.
Quick way to fill the blanks in Excel:
Select the table
Hit F5
Click Special
Tick "Blanks" and hit OK
All blank cells in the table are now selected. Without changing the selection,
type a = sign
hit the up arrow key on your keyboard.
Hold down Ctrl and hit Enter
Now all previously blank cells contain a formula that references the cell right above. Copy the table and paste it over itself with Paste Special > Values to replace the formulas with the values.
Far less key strokes than writing a macro, and faster in the processing, too.
I have bulk of data in an Excel sheet and I saved it into .csv format like this:
101,shortname,null,Description
My question is how to place single quotes for text data like
101,'shortname',null,'description'
?
101,shortname,null,Description
1) Is this in the single cell or different cells in excel?
2) Do you want to update the excel sheet or just want to put that data in mysql?
If you want to take data from excel and put it into mysql you can use apache-poi libraries.
apache-poi
I used this library to update the excel sheet from mysql database.
Get an editor capable of doing search/replace with regular expressions
Write a regular expression that will update the text the way you want it to
Here's an example how to do what you ask in Visual Studio's text editor:
Find what:
{[^,]+},{[^,]+},{[^,]+},{[^,]+}
Replace with:
\1,'\2',\3,'\4'
If you have some other editor, go check its documentation on regular expressions.
For VIM check out vimregex.com, something like this might work:
s:\([^,]\+\),\([^,]\+\),\([^,]\+\),\([^,]\+\):\1,'\2',\3,'\4':
so you want your csv data to add a single quote and restore in the same file? I this is so, simply copy/cut that column in some other column and use an excel formula like suppose you have your shortname in column B cut-paste it to column Z and use formula =CONCATENATE("'",Z#,"'") # is the row number
I want to copy a sql result set and paste it in Excel. But the data I paste in to the spreadsheet doesn't want to recognize Excel formatting. So if I change a column to currency, it doesn't do anything. But...if I double click on a cell, THEN it applies the currency format. But only to that cell.
How can I make it automatically recognize the Excel format?
I must be something I'm missing. Hopefully somebody can help. :-)
After you input the data into the columns in Excel, highlight all cells, then select the Data tab in the top ribbon. In the data tab click on Text to Columns, in the pop-up window select Delimited, then uncheck all of the boxes in Step 2 on that pop-up and select Finish. It will force all of the cells to update to your formatting.
Have you tried <edit><paste special> and then paste the data as text? Otherwise you're copying data AND formatting, which might be the problem.
You can right click on the SQL Grid and pick the the Save Results As option and save as csv. Open the csv in excel copy the content and paste in your destination Excel worksheet.
Seconding the <edit><paste special>, but another useful feature is <Text to Columns>. So if you paste your data as text, if it does not automatically appear in columns, use the Text to Columns to turn it into columns, then any formatting you apply should work.
Change your excel column format into text and then paste special -> TEXT