This is a quick and dirty version for what I think you are trying to do. Note that its not good Stack Exchange practise to keep asking variations of the question. One caveat with the Export help is that most useful stuff is held under each file format - so try looking at the help for XLSX.
a = {"WMO44203", "WMO44207", "WMO44212"};
dset = WeatherData[#,
"Temperature", {{1956, 1, 1, 0, 0}, {2015, 4, 1, 0, 0}},
TimeZone -> +8] & /@ a
If we create a nested list for the date instead of using Append in your example, we can get the entire date in one excel cell. i.e. {date}, value. You could also still use the Append version in your question and then use &
and DateValue
in Excel to convert the values to a date. eg =DateValue(a1&'\'&b1&'\'&c1)
exports = {DateList[#[[1]]], #[[2]]} & /@ #["Path"] & /@ dset;
Export["weather.xlsx",
"Sheets" -> {"WMO44203" -> exports[[1]], "WMO44207" -> exports[[2]],
"WMO44212" -> exports[[3]]}, "Rules"]
Edit
To use this with n sheets where n= number of weather stations :
Export["test.xlsx", "Sheets" -> Rule @@@ Transpose@{a, exports}, "Rules"]
Taken directly from @Belisarius answer here
Note
There may be a small bug - on my Excel (2011 for Mac) the export creates a file that Excel thinks is corrupt - if you accept the repair it gives the last sheet still as a Mathematica List in cell A1 rather than Rows/Columns. As a work around I would suggest exporting the last Station twice and then just deleting the last sheet after the repair.
Additional
If you get Java errors try increasing the Java Heap size with the following, if it still fails try changing 2048 by multiples of 1024 e.g. 3072, 4096 etc :
Export::nojmem: There was insufficient Java heap space for the
operation
<< JLink`;
InstallJava[];
ReinstallJava[CommandLine -> "java", JVMArguments -> "-Xmx2048m"];
#["Path"] & /@ shifted
at the end of yourTshift =
line. Path is not working in that line because its trying to use a List of 4 separate time series, and Mathematica doesn't know how to do that directly. So we use Map (@) to pass 1 time series at a time to Path and the rest of the code on that line. Its worth spending some time trying to understand Map its pretty key to huge ranges of mathematica functionality. $\endgroup$b = shifted[[1, All, 1]]
DateList[#] & /@ b
. This code worked successfull.DateList[#[[1, All, 1]]] & /@ shifted["Path"]
. This code not working.Why? $\endgroup$