# Issue with transferring list with different length to excel

I have two lists with different lengths and would like to transfer them to excel with the titles "Normalx+" and "Normaly+" respectively. I am using the following script, although it works but generates the following error message

Error message: PadRight::ilsm: List of machine-sized integers expected at position 2 in PadRight[{{0.314695,0.202724,0.445823,0.137051,0.340344,0.210384,0.0014843,-0.00337419,0.115197},{0.525304,0.0501755,0.796942,0.167022}},P].

Normalxp = {0.314695, 0.202724, 0.445823, 0.137051, 0.340344,
0.210384, 0.0014843, -0.00337419, 0.115197}
Normalyp = {0.525304, 0.0501755, 0.796942, 0.167022}
Firstraw = {"Normalx+", "Normaly+")}
Transpose[
PadRight[{Normalxp, Normalyp}, P]];
P11 = % /. P -> Sequence[]
P12 = Insert[P11, Firstraw, 1]
P12 // TableForm
Export["RMS-Cropped.xls", P12]


I would like to know what the reason is and how I can solve the issue? Thank you!

• What is P? PadRight needs a number there. – flinty Jul 11 '20 at 21:34
• Thank you Flinty! I found this method from the Possible issues section on the Transpose page: reference.wolfram.com/language/ref/Transpose.html. I think it is a random variable which can be added and then removed. – Mehdi Ebadi Jul 11 '20 at 21:54

## 1 Answer

You need to tell PadRight up to what dimension to pad. In your case you would want something of dimension {2,9}, so this should work:

Normalxp = {0.314695, 0.202724, 0.445823, 0.137051, 0.340344,
0.210384, 0.0014843, -0.00337419, 0.115197};
Normalyp = {0.525304, 0.0501755, 0.796942, 0.167022};
Firstraw = {"Normalx+", "Normaly+"};
Transpose[
PadRight[{Normalxp, Normalyp}, {2,9}, P]]
P11 = % /. P -> Sequence[]
P12 = Insert[P11, Firstraw, 1]
P12 // TableForm
Export["RMS-Cropped.xls", P12]

• Thank you! Yes, it is solved! – Mehdi Ebadi Jul 11 '20 at 22:27