Loading dated files in Tableau
I started to use Tableau Desktop as a tool to visualise my data.
However, my data is stored in CSV files with a date format name (e.g. datasample_yyyymmdd.csv). I need to be able to load in my files as the date is changing every day.
How do I do this in Tableau?
I searched on Google for answers, but nothing clear.
csv load tableau tableau-public
add a comment |
I started to use Tableau Desktop as a tool to visualise my data.
However, my data is stored in CSV files with a date format name (e.g. datasample_yyyymmdd.csv). I need to be able to load in my files as the date is changing every day.
How do I do this in Tableau?
I searched on Google for answers, but nothing clear.
csv load tableau tableau-public
Do you need your files aggregated for each new day or do you only want the most recent?
– vizyourdata
Nov 12 '18 at 17:22
@vizyourdata I want to use the most recent one.
– ECode
Nov 12 '18 at 17:35
add a comment |
I started to use Tableau Desktop as a tool to visualise my data.
However, my data is stored in CSV files with a date format name (e.g. datasample_yyyymmdd.csv). I need to be able to load in my files as the date is changing every day.
How do I do this in Tableau?
I searched on Google for answers, but nothing clear.
csv load tableau tableau-public
I started to use Tableau Desktop as a tool to visualise my data.
However, my data is stored in CSV files with a date format name (e.g. datasample_yyyymmdd.csv). I need to be able to load in my files as the date is changing every day.
How do I do this in Tableau?
I searched on Google for answers, but nothing clear.
csv load tableau tableau-public
csv load tableau tableau-public
asked Nov 12 '18 at 15:06
ECodeECode
4518
4518
Do you need your files aggregated for each new day or do you only want the most recent?
– vizyourdata
Nov 12 '18 at 17:22
@vizyourdata I want to use the most recent one.
– ECode
Nov 12 '18 at 17:35
add a comment |
Do you need your files aggregated for each new day or do you only want the most recent?
– vizyourdata
Nov 12 '18 at 17:22
@vizyourdata I want to use the most recent one.
– ECode
Nov 12 '18 at 17:35
Do you need your files aggregated for each new day or do you only want the most recent?
– vizyourdata
Nov 12 '18 at 17:22
Do you need your files aggregated for each new day or do you only want the most recent?
– vizyourdata
Nov 12 '18 at 17:22
@vizyourdata I want to use the most recent one.
– ECode
Nov 12 '18 at 17:35
@vizyourdata I want to use the most recent one.
– ECode
Nov 12 '18 at 17:35
add a comment |
2 Answers
2
active
oldest
votes
This can be done with Tableau alone if your data is not extremely huge.
Create a union in your csv connection, select the type as Wildcard and enter the pattern.
Create a data source/extract filter to keep only Top 1 path. (Extract recommended)
Final Result (Here 20181111 is the latest file)
PS: For some date formats, TOP 1 of max may not return the correct result. In that case, create a calculated date field from filename and apply TOP1 filter based on that.
Cool! I hadn't seen this before. Which version are you running?
– vizyourdata
Nov 12 '18 at 22:14
@vizyourdata, 2018.2, but I remember using this even in 10.0. Please note that for some date formats, you might need to convert it to a date before applying the TOP filter as max may not interpret it correctly.
– Jose Cherian
Nov 12 '18 at 23:26
add a comment |
This is something that can be done outside of Tableau in a batch command or python script. Both can be automated with Windows scheduler if on Windows. Ultimately, you want to pick up the most recent file and copy it to something like datasample_today.csv then connect Tableau to that file. Tableau will then always be connected to the latest file. Here is how you could do it in Python.
Python:
import glob
import os
list_of_files = glob.glob('/path/to/folder/*.csv') #* is wildcard
latest_file = max(list_of_files, key=os.path.getctime)
print(latest_file)
from shutil import copyfile
copyfile(latest_file, '<your dir>datasample_today.csv')
I'm not at all proficient in batch commands so you'll have to test this out and there is a lot here on SO to help.
Batch:
FOR /F %%I IN ('DIR *.* /B /O:-D') DO COPY %%I <<NewDir>> & EXIT
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%2f53264937%2floading-dated-files-in-tableau%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
This can be done with Tableau alone if your data is not extremely huge.
Create a union in your csv connection, select the type as Wildcard and enter the pattern.
Create a data source/extract filter to keep only Top 1 path. (Extract recommended)
Final Result (Here 20181111 is the latest file)
PS: For some date formats, TOP 1 of max may not return the correct result. In that case, create a calculated date field from filename and apply TOP1 filter based on that.
Cool! I hadn't seen this before. Which version are you running?
– vizyourdata
Nov 12 '18 at 22:14
@vizyourdata, 2018.2, but I remember using this even in 10.0. Please note that for some date formats, you might need to convert it to a date before applying the TOP filter as max may not interpret it correctly.
– Jose Cherian
Nov 12 '18 at 23:26
add a comment |
This can be done with Tableau alone if your data is not extremely huge.
Create a union in your csv connection, select the type as Wildcard and enter the pattern.
Create a data source/extract filter to keep only Top 1 path. (Extract recommended)
Final Result (Here 20181111 is the latest file)
PS: For some date formats, TOP 1 of max may not return the correct result. In that case, create a calculated date field from filename and apply TOP1 filter based on that.
Cool! I hadn't seen this before. Which version are you running?
– vizyourdata
Nov 12 '18 at 22:14
@vizyourdata, 2018.2, but I remember using this even in 10.0. Please note that for some date formats, you might need to convert it to a date before applying the TOP filter as max may not interpret it correctly.
– Jose Cherian
Nov 12 '18 at 23:26
add a comment |
This can be done with Tableau alone if your data is not extremely huge.
Create a union in your csv connection, select the type as Wildcard and enter the pattern.
Create a data source/extract filter to keep only Top 1 path. (Extract recommended)
Final Result (Here 20181111 is the latest file)
PS: For some date formats, TOP 1 of max may not return the correct result. In that case, create a calculated date field from filename and apply TOP1 filter based on that.
This can be done with Tableau alone if your data is not extremely huge.
Create a union in your csv connection, select the type as Wildcard and enter the pattern.
Create a data source/extract filter to keep only Top 1 path. (Extract recommended)
Final Result (Here 20181111 is the latest file)
PS: For some date formats, TOP 1 of max may not return the correct result. In that case, create a calculated date field from filename and apply TOP1 filter based on that.
edited Nov 12 '18 at 23:29
answered Nov 12 '18 at 21:46
Jose CherianJose Cherian
3,31812327
3,31812327
Cool! I hadn't seen this before. Which version are you running?
– vizyourdata
Nov 12 '18 at 22:14
@vizyourdata, 2018.2, but I remember using this even in 10.0. Please note that for some date formats, you might need to convert it to a date before applying the TOP filter as max may not interpret it correctly.
– Jose Cherian
Nov 12 '18 at 23:26
add a comment |
Cool! I hadn't seen this before. Which version are you running?
– vizyourdata
Nov 12 '18 at 22:14
@vizyourdata, 2018.2, but I remember using this even in 10.0. Please note that for some date formats, you might need to convert it to a date before applying the TOP filter as max may not interpret it correctly.
– Jose Cherian
Nov 12 '18 at 23:26
Cool! I hadn't seen this before. Which version are you running?
– vizyourdata
Nov 12 '18 at 22:14
Cool! I hadn't seen this before. Which version are you running?
– vizyourdata
Nov 12 '18 at 22:14
@vizyourdata, 2018.2, but I remember using this even in 10.0. Please note that for some date formats, you might need to convert it to a date before applying the TOP filter as max may not interpret it correctly.
– Jose Cherian
Nov 12 '18 at 23:26
@vizyourdata, 2018.2, but I remember using this even in 10.0. Please note that for some date formats, you might need to convert it to a date before applying the TOP filter as max may not interpret it correctly.
– Jose Cherian
Nov 12 '18 at 23:26
add a comment |
This is something that can be done outside of Tableau in a batch command or python script. Both can be automated with Windows scheduler if on Windows. Ultimately, you want to pick up the most recent file and copy it to something like datasample_today.csv then connect Tableau to that file. Tableau will then always be connected to the latest file. Here is how you could do it in Python.
Python:
import glob
import os
list_of_files = glob.glob('/path/to/folder/*.csv') #* is wildcard
latest_file = max(list_of_files, key=os.path.getctime)
print(latest_file)
from shutil import copyfile
copyfile(latest_file, '<your dir>datasample_today.csv')
I'm not at all proficient in batch commands so you'll have to test this out and there is a lot here on SO to help.
Batch:
FOR /F %%I IN ('DIR *.* /B /O:-D') DO COPY %%I <<NewDir>> & EXIT
add a comment |
This is something that can be done outside of Tableau in a batch command or python script. Both can be automated with Windows scheduler if on Windows. Ultimately, you want to pick up the most recent file and copy it to something like datasample_today.csv then connect Tableau to that file. Tableau will then always be connected to the latest file. Here is how you could do it in Python.
Python:
import glob
import os
list_of_files = glob.glob('/path/to/folder/*.csv') #* is wildcard
latest_file = max(list_of_files, key=os.path.getctime)
print(latest_file)
from shutil import copyfile
copyfile(latest_file, '<your dir>datasample_today.csv')
I'm not at all proficient in batch commands so you'll have to test this out and there is a lot here on SO to help.
Batch:
FOR /F %%I IN ('DIR *.* /B /O:-D') DO COPY %%I <<NewDir>> & EXIT
add a comment |
This is something that can be done outside of Tableau in a batch command or python script. Both can be automated with Windows scheduler if on Windows. Ultimately, you want to pick up the most recent file and copy it to something like datasample_today.csv then connect Tableau to that file. Tableau will then always be connected to the latest file. Here is how you could do it in Python.
Python:
import glob
import os
list_of_files = glob.glob('/path/to/folder/*.csv') #* is wildcard
latest_file = max(list_of_files, key=os.path.getctime)
print(latest_file)
from shutil import copyfile
copyfile(latest_file, '<your dir>datasample_today.csv')
I'm not at all proficient in batch commands so you'll have to test this out and there is a lot here on SO to help.
Batch:
FOR /F %%I IN ('DIR *.* /B /O:-D') DO COPY %%I <<NewDir>> & EXIT
This is something that can be done outside of Tableau in a batch command or python script. Both can be automated with Windows scheduler if on Windows. Ultimately, you want to pick up the most recent file and copy it to something like datasample_today.csv then connect Tableau to that file. Tableau will then always be connected to the latest file. Here is how you could do it in Python.
Python:
import glob
import os
list_of_files = glob.glob('/path/to/folder/*.csv') #* is wildcard
latest_file = max(list_of_files, key=os.path.getctime)
print(latest_file)
from shutil import copyfile
copyfile(latest_file, '<your dir>datasample_today.csv')
I'm not at all proficient in batch commands so you'll have to test this out and there is a lot here on SO to help.
Batch:
FOR /F %%I IN ('DIR *.* /B /O:-D') DO COPY %%I <<NewDir>> & EXIT
edited Nov 12 '18 at 22:17
answered Nov 12 '18 at 19:25
vizyourdatavizyourdata
70011234
70011234
add a comment |
add a comment |
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%2f53264937%2floading-dated-files-in-tableau%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
Do you need your files aggregated for each new day or do you only want the most recent?
– vizyourdata
Nov 12 '18 at 17:22
@vizyourdata I want to use the most recent one.
– ECode
Nov 12 '18 at 17:35