When exporting an indexed mode image to a gif spritesheet, if the palette contains multiple entries of the same color, pixels don’t retain their original index but are all set to the earliest occurrence of that color in the palette.
I.e. if the palette contains #FF0000 at index 1 and 55, and there are pixels that when eyedropped in the aseprite file say 1 and 55, and you export that file to a gif spritesheet, both pixels will now say index 1 if eyedropped. This behavior does not occur when exporting as bmp, tga, or png.
Unfortunately bmp and tga seem to not have transparency on export, and png is a format that is incredibly difficult to read; almost all libraries that read png files will convert all pixel data into RGBA on load, so there’s no way to get the indexed data, and png decompression is pretty difficult to implement manually.