--
You received this message because you are subscribed to the Google Groups "GAM for Google Workspace" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-man...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-manager/429403b2-cefb-4705-be3e-17404c496d99n%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-manager/DEE32EB4-4ADD-4E21-9F95-38101D3E4619%40gmail.com.
function myFunction() {
// Please set the final order of headers.
const finalOrder = ["header2", "header5", "header1", "header4", "header3"];
const sheet = SpreadsheetApp.getActiveSheet();
const obj = sheet
.getRange(1, 1, 1, sheet.getLastColumn())
.getValues()[0]
.reduce(
(ar, h, i) => [...ar, { from: i + 1, to: finalOrder.indexOf(h) + 1 }],
[]
)
.sort((a, b) => (a.to > b.to ? 1 : -1));
for (let i = 0; i < obj.length; i++) {
if (obj[i].from != obj[i].to) {
sheet.moveColumns(sheet.getRange(1, obj[i].from), obj[i].to);
obj.forEach((e, j) => {
if (e.from < obj[i].from) obj[j].from += 1;
});
}
}
}To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-manager/CAKM%3DboY12D55Jssjnm4N8%3Dqgjk-5%3Dysx81KRJ_V7zaNZknhR7Q%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-manager/CAD2sLFt-gRD6JU%3D5_-vqYw0yOT6aDqeZNUzK_Cn-pvzAnYMr_A%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-manager/CAD2sLFt-gRD6JU%3D5_-vqYw0yOT6aDqeZNUzK_Cn-pvzAnYMr_A%40mail.gmail.com.
Thanks for all the replies. Kevin the app script idea kinda neat could be useful for other things also.I've used app script very little so not sure how all the commands work. Ian I haven't really used BQ so not super familiar with it how how to use it. Wouldn't mind knowing more on how you're doing it. Ross are those new? I didn't see them in the csv output section but sounds like it would work
You received this message because you are subscribed to a topic in the Google Groups "GAM for Google Workspace" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-apps-manager/J21a_PnNDKI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-apps-man...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-manager/A8BC3D54-1617-4A17-B59B-57652A9446AB%40gmail.com.
* `csv_output_header_force` - A list of <Strings> used to specify the exact column headers to include
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-manager/CAOqG7ygCEs5gPVQkB-RgKeG3-5SahybACYDO-3osS80Q0UrfuQ%40mail.gmail.com.