This Review addresses the means by which epithelia change the direction of vectorial ion transport. Recent studies have revealed that insect Malpighian (renal) tubules can switch from secreting to reabsorbing K+. When the gut of larval lepidopterans is empty (during the moult cycle) or when the larvae are reared on K+-deficient diet, the distal ileac plexus segment of the tubule secretes K+ from the haemolymph into the tubule lumen. By contrast, in larvae reared on K+-rich diet, ions and fluid are reabsorbed from the rectal lumen into the perinephric space surrounding the cryptonephridial tubules of the rectal complex. Ions and fluid are then transported from the perinephric space into the lumen of the cryptonephridial tubules, thus supplying the free segments of the tubule downstream. Under these conditions, some of the K+ and water in the tubule lumen is reabsorbed across the cells of the distal ileac plexus, allowing for expansion of haemolymph volume in the rapidly growing larvae, as well as recycling of K+ and base equivalents. RNA sequencing data reveal large-scale changes in gene transcription that are associated with the switch between ion secretion and ion reabsorption by the distal ileac plexus. An unexpected finding is the presence of voltage-gated, ligand-gated and mechanosensitive ion channels, normally seen in excitable cells, in Malpighian tubules. Transcriptomic surveys indicate that these types of channels are also present in multiple other types of vertebrate and invertebrate epithelia, suggesting that they may play novel roles in epithelial cell signalling and regulation of epithelial ion transport.