How to prepare excel wide-format data for r's pivot_longer and tidyr
- Step 1Identify ID and value columns in your wide Excel data — ID columns stay (e.g. Country, Product); value columns become rows (e.g. Year_2021, Year_2022).
- Step 2Configure and run the unpivot — Enter ID column names and value column names. Name the variable column 'year' or 'period'.
- Step 3Import into R — read_xlsx('output.xlsx') and pipe directly into dplyr::group_by() or ggplot2::ggplot().
Frequently asked questions
Is this equivalent to tidyr::pivot_longer()?+
Functionally yes. The output is the same structure that pivot_longer would produce from the same input data.
Why not just use pivot_longer inside R?+
If the Excel file is already the data source, pivoting in the browser avoids reading the wide format into R at all — useful for very large files that are slow to load.
Does it work for melt() in Python pandas too?+
Yes. The long-format output is identical to what pandas.melt() would produce. Use it for Python and R workflows alike.
Privacy first
Every JAD Excel tool runs entirely in your browser using SheetJS and ExcelJS. Your spreadsheets, formulas, and data never leave your device — verified by zero outbound network requests during processing.