How to prevent or make Data Interpreter to take only the first row in your CSV file to take as headers..? - tableau-api

I connected a new data source, a CSV file, in tableau, and the headers are displayed as F1, F2, and F3, so I did some googling. I found that I can use Data Interpreter to fix the issue, but after clicking it, it takes both the first and second rows combined as headers. Still, I only want the first row to be headers.. how do I make sure that only the first row is treated as headers instead of the first and second row combined.
I am attaching the screenshots for reference.
before using the data interpreter
after using the data interpreter

Related

MUI-X data grid exports empty rows instead of content

When clicking on the export button, some rows are empty in the exported CSV file.
Here is a sample content of the DataGrid:
Here is the exported CSV:
As you can see, all rows are exported in columns 2-5, but under the first column, only three are exported. The rest is empty.
Link to live example: https://tineye-next.vercel.app/
The issue was on my side. For some reason, the URLs stored in firestore start with \n, and the data exported, but I could not see the value because of the control character.

How to split data into rows

Hi I want to split one data columns by ";" and add it into rows. I believe in tableau this is called pivoting. But it wont work for me.
I have no issues splitting the data by delimiter, but it add's as column and not row. I don't get the option of pivoting afterwards, it could be due its a 'caulculated' field?
This one is not so easy, but let's get through this:
This is my sample data:
ID is still a number, I convert it to a dimension later.
Now, instead of creating a calculated field you do a custom split on your data, just like shown below. In the window that opens up you insert your seperator, which is ";" and the number of columns you need, which seems to be 10 in your case. I choose 3.
Then you create a table like this one:
and go on to create a crosstable like this:
then you klick on data and then paste. You'll now get a crosstable in a new sheet.
Now proceed by right-clicking on the newly created data source,
select the three Country-Split-columns, choose one to click on the arrow and click pivot. No you can delete the Country-Split-columns and you get this:
I think this might be what you want.

Keep leading zeros when joining data sources in tableau

I am trying to create a data source in Tableau (10.0) where I am joining a table from SQL with an Excel file. The join happens on a site id but when reading the id from the excel source, Tableau strips the leading zeros (and SQL keeps leading zeros). I see this example
to add the leading zeros back as a new, calculated field. But the join is still dropping rows because the id is not properly formatted when making the join.
How do I get the excel data source to read the column with the leading zeros so I can do the join?
Launch Excel and choose to open a new blank workbook.
Click the Data tab and select From Text.
Browse to the saved CSV file and select Import.
Ensure that Delimited is selected and click Next.
Leave Tab as the delimiter and click Next.
Select the column containing the data with leading zeros and click
Text.
Repeat for each column which contains leading zeros.
Click Finish.
Click OK.
Never heard of or used tableau, but it sounds as though something (jet/ace database driver being used to read excel file?) is determining the column to be numeric and parsing the data as numbers, losing leading zeroes
If your attempts at putting them back are giving you grief, I'd recommend trying the other direction instead; get sqlserver to convert its strings to numbers. Number matching should be more reliable than String matching, so long as the two systems don't handle rounding differently :)
If your Excel file was read in from a CSV and the Site ID is showing "Number Stored as Text", I think you can solve your problem by telling Tableau on the Data Source entry that the field is actually a string. On the preview data source view, change the "#" (designating number) to string so that both the SQL source and the Excel source are both strings before doing the join.
This typically has to do with the way Excel stores values as mentioned above. I would play around with the number formatting for the Site ID column in Excel itself, not Tableau, and changed that two "Text" in Excel. You can verify if Tableau will read it properly with the leading 0s by exporting your excel file to csv and looking in the csv files to see if the leading 0s are still there.

Libreoffice Calc reference cell with a specific progression

I have a collumn with this contend inside:
=sheet1.F8
=sheet1.F15
=sheet1.F22
Normally in the excel I select the three cells and pull down, excel understand the logic and the next cell above will be "sheet1.F29". But if I do this in Libreoffice it puts "sheet1.F11".
Do you have any idea of how to do this ? (I have several sheets like this logic and I'd like to use Libreoffice instead Excel).
I found a workaround and replying here:
It is setting the reference to “F11” because the first row contains a reference to F8 and the new entry is 3 rows beneath this i.e., the offset is based on the first cell of the selection, thus 8+3=11. A workaround is to use the addresses of the destination and combine this with the INDIRECT() function. For example, create a separate column with “Sheet1.F8”, “Sheet1.F15”, and Sheet1.F22” etc. Highlight and drag this column of values to obtain a column of correct address references. Then adjacent to this use (given “Sheet1.F8” in sheet 2 cell A1) =INDIRECT(A1) in B1. Now drag this down the B column to obtain the required values.

Can Spreadsheet::WriteExcel change the format of a cell without modifying its contents?

In my Perl script I use the Spreadsheet::WriteExcel module to create an Excel file. The file contains a table, the size of which is dynamic - i.e., I don't know how many rows it will have until the table is already created. I would like the last row of the table to have a slightly different format (e.g., its bottom border to be "==="). Unfortunately, I cannot apply this (different) format at the time when the row is being created, since at that time I don't know yet that it will be the last row.
So, my question is: can I change the format of an already existing cell without changing its contents? If I pass undef as cell value to the $worksheet->write() method it just overwrites the contents of the cell with a blank cell.
The direct answer to your question is that you cannot modify the format of an already written cell in Spreadsheet::WriteExcel. This is a planned feature for Excel::Writer::XLSX but it isn't in place yet.
So you will need to workaround it in some way such as buffering the table data until you are ready to write it or buffering a row at a time and only writing it when you have a new row.
Or you could turn on compatiblilty_mode() and overwrite the last row with new formatted data. Note, this approach isn't recommended without compatibility_mode() since Excel will complain about duplicate and or missing data in the file.
Alternatively, setting the row format, as pointed out by #bvr, might work for you.
Unless your data is too big for memory, you can put your table data in an array first, then loop over the array to output. You'll have access to any element in the array to begin with, so you'll know what the last row will be and what kinds of data will be in it.
You can set the format to any row with set_row method without changing the data.